質問

In my FragmentActivity, I have a Fragment(let's call it HubFrag) which has a ViewPager using a FragmentStatePagerAdapter (which create some Fragments, let's call them 'ItemFrag').

When I replace HubFrag by another new Fragment,HubFrag is destroyed like expected but it's not the case for the ItemFrags Objects. Using eclipse mat i see that my ItemFrags Objects are retained by a FragmentManagerImpl of my FragmentActivity... Why????

I explain why i don't want them to still in memory:

Each ItemFrag launch a picture download and my downloader (which has a WeakReference of the ItemFrag ImageView)don't want to process the Bitmap if this weak reference is null(to reduce memory use).

But the downloader will always decode the Bitmap as the weak reference is never null... Thanks!

役に立ちましたか?

解決

I found what cause my problem: I populate the HubFrag's ViewPager using getSupportFragmentManager, using getChildFragmentManager resolved the problem.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top