I have an AsyncTaskLoader that is being reset in a very specific case, and was hoping someone may be able to tell me why.
- In my activity, I am calling
getSupportLoaderManager().initLoader(0, null, this)
in theonCreate()
method. Everything runs as expected:
D/Activity﹕ calling initLoader()
D/Activity﹕ onCreateLoader()
D/Loader﹕ onStartLoading()
D/Loader﹕ onStartLoading(): no data, forcing load
D/Loader﹕ loadInBackground()
D/Activity﹕ onLoadFinished()
- But if I background the app (hit home), rotate the device, and then return it to the foreground, I'm seeing the loader is reset:
D/Activity﹕ onLoaderReset()
D/Activity﹕ calling initLoader()
D/Activity﹕ onCreateLoader()
D/Loader﹕ onStartLoading()
D/Loader﹕ onStartLoading(): no data, forcing load
D/Loader﹕ loadInBackground()
D/Activity﹕ onLoadFinished()
The loader isn't reset when the app is sent to the background and restored (in the same orientation) and it's not reset when rotating the device while the app is in the foreground. Thus, I wouldn't expect it to be reset in the circumstances described in #2.
Can anyone provide any insight? I'm trying to prevent the app from making an unnecessary call in the off change that someone backgrounds the app, rotates the device, and and then restores the app. Thanks