简体   繁体   中英

ViewPager calls onPause() onResume()

When I using ViewPager with fragments onPause() , onResume() methods are called when moving to tabs which are far from the one more than 1 tabs.

I want to save all the fragments data so don't want to call onPause() , onResume() in the Activity .

How can I stop calling those functions?

Thank you

By default, the viewPager only keep in memory one fragment in each side.. is like this:

mViewPager.setOffscreenPageLimit(1);

You can increase that number, but be careful, you can easily run out of memory..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM