Nested Fragments - Relationship between child fragments in parent fragment in viewpager

I am working on the initial design of the application here, and I am having some problems with the way I want everything to work.

Initial Background:

The application uses ActionBarSherlock for a common user interface. This is a tabbed project that uses the ViewPager along with the FragmentStatePagerAdapter to exchange between different tabs (which are SherlockFragments).

In particular, one tab represents the Sherlock Fragment style of the master part, which contains and displays two nested fragments: Sherlock List (master) and the usual Sherlock Fragment (part).

All the examples I've seen on how to create a master / part with fragments show a list that communicates with parts through an interface callback, which is then implemented in FragmentActivity, to which fragments of the master / part are attached.

In my case, although there is no FragmentActivity, these two fragments are inside the parent Sherlock Fragment. How can I get listFragments onItemSelected to update detailFragment? Is it possible to configure an interface callback between two fragments directly (or through the parent fragment) without involving the FragmentActivity function?

+4
source share

Source: https://habr.com/ru/post/1497488/


All Articles