OSDN Git Service

Improve Exception message for adding private fragments
authorClara Bayarri <clarabayarri@google.com>
Thu, 23 Jun 2016 10:08:55 +0000 (11:08 +0100)
committerClara Bayarri <clarabayarri@google.com>
Fri, 24 Jun 2016 11:30:21 +0000 (12:30 +0100)
State which fragment is the culprit

Bug: 29565251
Change-Id: If571488882e495c09344bb06376346b3ae8dff16

core/java/android/app/BackStackRecord.java

index 00ed21f..fb3ba7c 100644 (file)
@@ -473,8 +473,9 @@ final class BackStackRecord extends FragmentTransaction implements
             if (targetSdkVersion > Build.VERSION_CODES.N && (fragmentClass.isAnonymousClass()
                     || !Modifier.isPublic(modifiers)
                     || (fragmentClass.isMemberClass() && !Modifier.isStatic(modifiers)))) {
-                throw new IllegalStateException("Fragment must be a public static class to be "
-                        + "properly recreated on configuration change.");
+                throw new IllegalStateException("Fragment " + fragmentClass.getCanonicalName()
+                        + " must be a public static class to be  properly recreated from"
+                        + " instance state.");
             }
         }
         fragment.mFragmentManager = mManager;