I’ve a FragmentPagerAdapter and I switch between ActionBarSherlock Tabs. When switching between Tabs, I hide one Fragment and Display another Fragment.
Now I’ve a question about the memory consumation, how the FragmentManager Releases the Fragments, if I hide it?
When there are more Fragments in it, is it possible to manually remove a Fragment Object from memory?
if I detach a Fragment, the Object is saved, if I remove a Fragment it is only removed from the View, if I set the Fragment = null, then the Fragment is not released, I always get a Fragment: myActivity.getSupportFragmentManager().findFragmentByTag(myTag);
Can someone explain me how the FragmentManager releases the Views, if it is neccessary and how I can realize that?
From android documentation.
So if You are worried about memory issues don’t use FragmentPagerAdapter, I would advice you to use FragmentStatePagerAdapter instead.
FragmentStatePagerAdapter works somewhat like a listview and is more efficient in terms of memory.