How to stop refreshing fragments on tab is changed?

Hey,
Sometimes fragment tabs are just pain.. They just reload each tab changes and it causes the lag and screen frozen. Fortunately, solution is simple :)
Markdown:
int limit = (mSectionsPagerAdapter.getCount() > 1 ? mSectionsPagerAdapter.getCount() - 1 : 1);
mViewPager.setOffscreenPageLimit(limit);
Gist:
/* DO NOT FORGET! The ViewPager requires at least “1” minimum OffscreenPageLimit */
int limit = (mSectionsPagerAdapter.getCount() > 1 ? mSectionsPagerAdapter.getCount() - 1 : 1);
mViewPager.setOffscreenPageLimit(limit);

We just set the setOffscreenPageLimit through the ViewPager..
DO NOT FORGET! The ViewPager requires at least “1” minimum OffscreenPageLimit.
The limit variable algorithm is simple. That’s it :)
Have fun, If you have any question, ask me !

How to extract filename from Uri?

Now, we can extract filename with and without extension :) You will convert your bitmap to uri and get the real path of your file. Now w...