Kris B
Kris B

Reputation: 3578

How to tell if AsyncTaskLoader is running

I am starting a AsyncTaskLoader using this:

getLoaderManager().initLoader(0, null, this);

I thought I could use this to tell if it's running:

Boolean isRunning = (getLoaderManager().getLoader(0) != null && getLoaderManager().getLoader(0).isStarted());

but isRunning always returns true.

Upvotes: 4

Views: 872

Answers (1)

Jiang Qi
Jiang Qi

Reputation: 4448

int the LoaderManager.LoaderCallbacks' onLoadFinished method, I usually

getLoaderManager().destroyLoader(loader.getId());

then

Boolean isRunning = getLoaderManager().getLoader(0) != null

Upvotes: 2

Related Questions