문제

I have a ViewPager with 3 Fragments in there. Each Fragment uses a AsyncTaskLoader to get there Data from a Database. Now i want to restart the loader of Fragment A from Fragment C but if i call

getLoaderManager.getLoader( "LOADER_A_ID" )

the result is null. I read each LoaderManager has one Activity/Fragment and so has each Fragment a own LoaderManager. Has anybody a good idea to solve my problem?

I would implement a GlobalLoaderManager which is a Singleton-Pattern and hold Fragment. The ViewPager reused his Fragments so i have only one instance of each Pager Fragment in this Manager.

도움이 되었습니까?

해결책

The answer is the post from Luksprog. Thank you for your help.

I've made a small adjustment to some old code to show you how you might do what I said above. You can find it here gist.github.com/3511928 – Luksprog

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top