Improve exception message thrown when a View's state is of the wrong type.
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 1fc3678..d94d0c2 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -5961,7 +5961,11 @@
protected void onRestoreInstanceState(Parcelable state) {
mPrivateFlags |= SAVE_STATE_CALLED;
if (state != BaseSavedState.EMPTY_STATE && state != null) {
- throw new IllegalArgumentException("Wrong state class -- expecting View State");
+ throw new IllegalArgumentException("Wrong state class, expecting View State but "
+ + "received " + state.getClass().toString() + " instead. This usually happens "
+ + "when two views of different type have the same id in the same hierarchy. "
+ + "This view's id is " + ViewDebug.resolveId(mContext, getId()) + ". Make sure "
+ + "other views do not use the same id.");
}
}