user6798995 user6798995 - 3 months ago 36
Android Question

Android tabbed activity losses data when slide

I created tabbed activity using view pager with three fragments (f1,f2,f3), if I made changes to f1 then when I slide f2 get back out won't lose the data but when I slide to f3 the changes on f1 were lost ,I want all the data to persist while sliding, how to do that ?


Try to change Offset Page Limit of your viewPager like below.


This method:

Sets the number of pages that should be retained to either side of the current page in the view hierarchy in an idle state.