Hi there,
I have a preferences activity where I can change the language and the theme of my application. From there I return to the previous activity via the Back key, and I want to recreate the activity.
I've managed to do that by reinitializing the layout in onResume
and also calling onRestoreInstanceState
from there. All the views are restored properly, with checkboxes checked if needed, edittexts filled with texts I left there previously.
But I also have a button which is initially disabled, and becomes enabled only when a radiobutton is checked. The problem with it is the following: I check the radiobutton, the button becomes enabled. Then I go to settings, change the theme there, and return to the first activity. When I arrive there, the radiobutton is restored as checked, but the button is disabled.
So it seems that the enabled/disabled state isn't being saved into the bundle, which seems counterintuitive. And I haven't found any code in the Android source that does this, too. Am I missing something, or do I have to write my own code for that?
EDIT: BTW, state is saved only for the views which have ids. And that button does have one, I guarantee that :)