• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Android TabLayout ViewPager not inflating properly on backstack

CynePhoba

Lurker
Hey Guys,

My original question can be seen here:

http://stackoverflow.com/questions/...pager-not-inflating-tab-fragment-on-backstack

Basically i've got a viewpager with multiple tabs. Each tab has its own fragment. The application contains a single activity and uses fragments to navigate through. When I view this particular outer fragment everything inflates fine. However when I navigate through the app and then use the backstack to navigate back to the tabs, it gets back to this fragment and then crashes.

From the debugging and breakpoints I have discovered that when navigating forward through the app it inflates the inner fragment correctly. However when navigating backwards the inner fragment is created with a new ID (therefore it seems to be a new instance) but all of the items inside that fragment are null - therefore it seems to me that the onCreateView of that fragment is not being called when the viewpager is remade from the backstack.

If anyone has any ideas about it then I will be eternally greatful! I've been stuck on this for a few months now and no-one on stack overflow was able to help so I'm hoping that someone on here can help! I can provide any further information if anyone needs it; project files etc.
 
Back
Top Bottom