Reusing fragments in a fragmentpageradapter?

The FragmentPagerAdapter already caches the Fragments for you. Each fragment is assigned a tag, and then the FragmentPagerAdapter tries to call findFragmentByTag. It only calls getItem if the result from findFragmentByTag is null.So you shouldn't have to cache the fragments yourself.

Yeah this is what I eventually sorted out. Thanks – jwanga Aug 18 at 4:04 yea, it would be clear if the method were named 'createItem' – Bo. 2 days ago.

What I did to stop creating new Fragments was to store their references on an array and then return that instead of a new one. It isn't the same but it does stop some waste. I also had to implement the save and restore part of the fragment lifecycle to get it working nicely.

The FragmentPagerAdapter already caches the Fragments for you. Each fragment is assigned a tag, and then the FragmentPagerAdapter tries to call findFragmentByTag. It only calls getItem if the result from findFragmentByTag is null.

So you shouldn't have to cache the fragments yourself.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions