Skip to content Skip to sidebar Skip to footer

Asynctaskloader Restart Loading When The Activity Restart

Hi I'm implementing a custom asynctaskloader to load data in the background. The problem is when the user goes back to the activity after he minimizes the app(or pick photo from ga

Solution 1:

This is the desired behavior of LoaderManager framework - it takes care of reloading the data with the initiated Loaders in case the enclosing Activity or Fragment get re-created.

In fact, some implementations of Loaders do not reload the data, but simply provide access to the latest data that has been cached internally.

Bottom line: you observe correct behavior of LoaderManager framework.

It is not clear what it is you're trying to accomplish with your Loader, but it looks like you chose an incorrect tool. If your goal is to perform the action just once, then you should use AsyncTask instead of Loaders.


Post a Comment for "Asynctaskloader Restart Loading When The Activity Restart"