Search code examples
androidandroid-fragmentsandroid-view

Wrong state class, expecting View State but received class android.widget.CompoundButton$SavedState instead


java.lang.IllegalArgumentException: Wrong state class, expecting View State but received class android.widget.CompoundButton$SavedState instead. This usually happens when two views of different type have the same id in the same hierarchy. This view's id is id/0x2. Make sure other views do not use the same id.

its occurs when screen rotate and when when trying go back to the fragment no id is repeated plzz some one help me


Solution

  • i have resolve it .... its because of duplication of ids of view mostly when we add view dynamically and not set ids (with same text of radio button in my case)

    to resolve first check all views those u are adding dynamically