Forum Xamarin Xamarin.Android

ILoaderCallbacks.OnLoadFinished not called second time

I have an activity that derives from FragmentActivity, and implements ILoaderCallbacks. In the constructor it calls SupportLoaderManager.InitLoader, and in OnCreateLoader it creates an AsyncTaskLoader subclass. The loader instance is also cached in a local variable. The task loader works, it fetches it's data, and when done, my activities OnLoadFinished is called. Excellent!
However...I have a button "Refresh" on the page, and when the user clicks that, I call my cached loader's ForceLoad method. The async task executes, but my activity's OnFinished is not called.
What am I doing wrong?


  • fljohwatfljohwat USMember
    edited October 2012

    OK...I figured this one out.

    1. I dont store the loader instance, the framework does that for me.
    2. Instead of forceLoad, I do this

    SupportLoaderManager.RestartLoader(0, null, this);

    Now it all works!
    For completeness, here is my code:

  • fljohwatfljohwat USMember

    See code attached.

Sign In or Register to comment.