Perhaps you could create a method to set the listener and call that from the Activity? If A_MAIN invokes the fragment F_DET, then it should set the listener of A_DET is the parent, then it should call the set listener method.
Marty On Sunday, October 26, 2014 5:03:55 AM UTC-5, Sergio Panico wrote: > > Hi all, > i just need some clarification about the best way to design a multi-pane > layout for my app. > > More in datail, i'm just interesting in understand how is the better way > to let the fragments communicate with their parent activity. > > Accordingly to what described here > http://developer.android.com/design/patterns/multi-pane-layouts.html > <http://developer.android.com/design/patterns/multi-pane-layouts.html> and > here > http://developer.android.com/training/basics/fragments/fragment-ui.html, i've > designed my UI with the following structure: > - a main activity (let say: A_MAIN) > - a list fragment (F_LIST) and its related activity (A_LIST) > - a detail fragment (F_DET) and its related activity (A_DET) > - an edit fragment (F_EDIT) and its related activity (A_EDIT) > > Moreover, each fragment > - defines an interface (OnFragmentInteractionListener) to send the user > action to its parent > - participates to the the action bar with the supported actions > > and the main activity (A_MAIN) implements the listener for all fragments > and has the following layouts: > - for smartphone (default), it contains only the F_LIST fragment. When > an item of the list is selected, it starts the A_DET with the F_DET > fragment for the selected item > - for tablet (sw600dp), it contains the F_LIST and F_DET fragments. When > an item of the list is selected, it refreshes the F_DET for the selected > item > > The issue is that the parent activity for F_DET could be both A_MAIN or > A_DET hence, in the smartphone scenario, i've some difficulties to send the > listener action to the A_MAIN because it is two levels back (F_DET -> A_DET > -> A_MAIN)... > > Where i'm wrong? > > (To better clarify, i just want the same interaction behavior of gMail app > when select an email...) > > I wait for your help and advice. > > Regards > Sergio > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.