I'm developing an android app, with TabHost & FragmentActivity in each tab.
In my first tab I initialize a fragment with a ViewPager indicator and a button,
this button open a dialog with another ViewPager indicator, but my problem is the ViewPager in the fragment root activity is clashing with the ViewPager's dialog.
In the root activity I'm calling getChildFragmentManager()... and is OK
but in the dialog ViewPager I'm calling again getChildFragmentManager but not working...
What am I doing wrong?
getSupportFragmentManager and getChildFragmentManager FragmentManager is class provided by the framework which is used to create transactions for adding, removing or replacing fragments.
ViewPager save Fragment in FragmentManager with particular tags, So We can get ViewPager's fragment by FragmentManager class by providing tag. And ViewPager provide tag to each fragment by following syntax : Fragment page = getSupportFragmentManager(). findFragmentByTag("android:switcher:" + R.
I think the dialog is independent from the fragments so try getFragmentManager() or if you are using support library use getSuportingFragmentManager()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With