Search code examples
androidandroid-activityloaderactivity-lifecycle

What happens to a Loader whose load is in progress when its activity is destroyed and recreated?


If a Loader has been created and is in the middle of loading and has not called onLoadFinished, and the associated Activity is destroyed and recreated (e.g. due to rotation), will onLoadFinished be called on the new instance of the Activity (assuming the Activity implements LoaderCallbacks)? If so, at what point in the new instance's lifecycle will this happen?


Solution

  • The new instance of the Activity will not receive a call to onLoadFinished. The activity will need to create or restart the Loader.