android - IllegalArgumentException: Wrong state class -



android - IllegalArgumentException: Wrong state class -

for activity, have 2 different layout files portrait , landscape orientations. elements of 1 orientation have direct relation elements in other orientation except may related base of operations class not exact same type , have same id. instance:

layout/main_layout.xml:

... <listview android:id="@+id/current_news_list" android:layout_width="fill_parent" android:layout_height="fill_parent"/>

then in layout-land/main_layout.xml: customlistview subclass of android.widget.adapterview

... <customlistview android:id="@+id/current_news_list" android:layout_width="fill_parent" android:layout_height="fill_parent"/>

"illegalargumentexception: wrong state class" thrown when changing orientations. expected behavior? have not overridden configuration changing code , i'm letting activity destroyed , reconstructed. i've avoided other instances of having identical identifiers in layout hierarchy @ same time.

set view's value saveenabled false.

http://developer.android.com/reference/android/view/view.html#attr_android:saveenabled

while changing orientation, tries save states of views have ids, , tries recreate same while recreating activity. so, case, 1 type cannot converted other type. ie. listview can't converted customlistview.

and then, have handle both orientations yourself.

android illegalargumentexception

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -