Fix issue #5063010: Loaders don't seem to be properly...
...retained with compatibility library
Yikes, and also in the main platform...! :(
Change-Id: I76ee3a9a5ba4a220c2f54d0af9cf49e3a736e7bd
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index aeb16f4..8d03ac7 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -1593,10 +1593,10 @@
//Log.v(TAG, "invalidateFragmentIndex: index=" + index);
if (mAllLoaderManagers != null) {
LoaderManagerImpl lm = mAllLoaderManagers.get(index);
- if (lm != null) {
+ if (lm != null && !lm.mRetaining) {
lm.doDestroy();
+ mAllLoaderManagers.remove(index);
}
- mAllLoaderManagers.remove(index);
}
}