1. Are you ready for the Galaxy S20? Here is everything we know so far!

Android TabLayout ViewPager not inflating properly on backstack

Discussion in 'Android Development' started by CynePhoba, Jan 10, 2016.

  1. CynePhoba

    CynePhoba Lurker
    Thread Starter

    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.
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...
Similar Threads - Android TabLayout ViewPager
  1. OM2
    Replies:
    2
    Views:
    86
  2. Rik Deschamps
    Replies:
    4
    Views:
    278
  3. wmw_hv
    Replies:
    0
    Views:
    214
  4. Harbut
    Replies:
    0
    Views:
    233
  5. Jeff Jot
    Replies:
    11
    Views:
    384
  6. Taewendy
    Replies:
    2
    Views:
    335
  7. Novice_Independence
    Replies:
    1
    Views:
    251
  8. Advait
    Replies:
    4
    Views:
    437
  9. annie333
    Replies:
    6
    Views:
    306
  10. Androiddeveloper_2021
    Replies:
    1
    Views:
    1,923

Share This Page

Loading...