I am programmatically adding x amount of buttons to my view depending on a config loaded (lets just use 10 for an example). I create the 10 just fine, and it works when I don't set an ID, or when I use Androids generateId() function, but I want to use my iterator (i) to set the id, so that each value of the iteration matches the button it creates
i.e.
(for i=0; i<10; i++)
{
button.setId(i);
}
I want this so that when I switch fragments, it saves the buttons and I don't recreate them with onCreate. As it stands, I get this error:
01-25 17:46:18.197 13236-13236/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.CompoundButton$SavedState
at android.widget.CompoundButton.onRestoreInstanceState(CompoundButton.java:379)