Improve Exception message for adding private fragments
State which fragment is the culprit
Bug: 29565251
Change-Id: If16d59932297840ee0c71261b39527a1b2eb5f3e
diff --git a/fragment/java/android/support/v4/app/BackStackRecord.java b/fragment/java/android/support/v4/app/BackStackRecord.java
index c5c8ce7..042cf9d 100644
--- a/fragment/java/android/support/v4/app/BackStackRecord.java
+++ b/fragment/java/android/support/v4/app/BackStackRecord.java
@@ -432,8 +432,9 @@
final int modifiers = fragmentClass.getModifiers();
if (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;