Android AsyncTaskLoader

Hi Guys,

Lately I ran into a small problem with AsyncTaskLoader, I thought it would help you if I share 🙂

I was using AsycTaskLoader class to implement background loading for my app. I have written the code
in LoadInBackground() Method. I’ve started the loader using –

getSupportLoader().initLoader(0,null,null);

But my loadInBackground() method was never getting called. After searching for some time, I came across the solution-

forceLoad();

has to be called in onStartLoading() method of AsyncTaskLoader without which your loadInBackground() method never gets called. I’m not sure about the reason but it works !!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s