Android - onLoadFinished not called

前端 未结 5 2225
谎友^
谎友^ 2021-02-14 12:03

I am facing an issue with Loader.

I have an Activity, which displays list of records retrieved from local DB. When the activity starts, records are automatically loaded

5条回答
  •  我在风中等你
    2021-02-14 12:59

    fwiw, I had a similar problem from attempting to immediately restart the loader a second time, before the first onLoadFinished was called, resulting in neither being called.

    this worked for me:

    if( loader == null )
        loader = loaderMngr.initLoader(
            0, null, myLoaderCallbacks
            ); 
    else if( loader.isAbandoned() )
        return;
    else
        loaderMngr.restartLoader(
            0, null, myLoaderCallbacks
            );    
    

提交回复
热议问题