Save and Restore state of Selected list of RecycleView in fragment on TabLayout or ViewPager



Add This Line To viewPager:-

viewPager = (ViewPager) findViewById(R.id.viewpager);
setupViewPager(viewPager);
viewPager.setOffscreenPageLimit(4);

Here 4 is the Number of Tabs.
If you have 3 tabs change to :-

viewPager = (ViewPager) findViewById(R.id.viewpager);
setupViewPager(viewPager);
viewPager.setOffscreenPageLimit(3);

Comments

Popular posts from this blog

Configuration 'androidTestCompile' is obsolete and has been replaced with 'androidTestImplementation' and 'androidTestApi'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html Configuration 'androidTestApi' is obsolete and has been replaced with 'androidTestImplementation'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Get Two digit after decimal point in Android or Java

Windows 7 all Version 64-Bit iso file Download with crack activation. (Google Drive Link)