When an activity is destroyed due to a configuration change, are its Loaders destroyed as well?
Asked Answered
F

0

6

From the developer guide on Loaders,

They automatically reconnect to the last loader's cursor when being recreated after a configuration change. Thus, they don't need to re-query their data.

From this blog post on Loaders,

when an Activity is destroyed, the Activity instructs its LoaderManager to destroy and close its Loaders (as well as any resources associated with them, such as a Cursor).

The question is that which one is correct? When an activity is destroyed because of a configuration change, what happens to (1) its Loaders (2) the resources associated with its Loaders, such as a Cursor.

Flatworm answered 30/6, 2015 at 2:24 Comment(2)
Configuration changes are handled a bit differently than destruction in the background or backstack. For example, fragment instances can be retained across configuration changes but not other types of destruction. This discrepancy could be something like that, but I don't know the details, which is why this is a comment instead of an answer.Shorthanded
@KevinKrumwiede i would server well as an answer though. but to add to that, Activities not containing resources or bare Activities gets killed instantly i mean their onDestroy() are called pretty quick but a much more loaded Activity takes time to call onDestroy(), i guess it translate to when to kill it thoroughly ..Cashier

© 2022 - 2024 — McMap. All rights reserved.