JetradarMobile / android-multibackstack

Persistent bottom navigation like in instagram
Apache License 2.0
216 stars 28 forks source link

onCreateView is called every time tab is switched #8

Open giusecapo opened 7 years ago

giusecapo commented 7 years ago

How can we prevent to lose the current status of the fragment?

I add more details: I'm building an app that has a tinder-like UI with cards. If user scrolls the cards deck, then change fragment, when it comes back the deck is re-load. I need to maintain the position, aka restore view status

egek92 commented 6 years ago

are you using ViewPager in your fragments? if so you need to setOffscreenPageLimit to how many fragments there is inside your viewpager

alcntml commented 6 years ago

Hi, I'm not using wiewpager, i just run your samplecode. I'm facing the same problem. In your sample code, onCreateView is called everytime but listviews does not recreated. I don't know why listview not recreate but others views that i added are recreates. (I added a textView with random number that i generate in onCreateview. And textview's text changed every time)

johnkil commented 5 years ago

When switching tabs, fragments are replaced, and the previous fragment putted into backstack with saved state. If you switch back, the fragment is recreated and restores its own state from the saved state.