Into my project I am using viewpager with three tabs named History
,Main
,Map
.Main activity contain Timer,stopwatch,etc
if you are working with FragmentPagerAdapter then just use destroyItem method inside FragmentPagerAdapter.
@Override
public void destroyItem(ViewGroup container, int position, Object object)
{
FragmentTransaction ft=fm.beginTransaction();
ft.remove((Fragment) object);
ft.commit();
}
setOffscreenPageLimit(int limit) consumes more memory and in some cases its not works perfectly. its retain state in either side see description.setOffscreenPageLimit(int limit) - Set the number of pages that should be retained to either side of the current page in the view hierarchy in an idle state.