Should onSaveInstanceState save the "enabledness" of the views?

Posted by neutrino on Stack Overflow See other posts from Stack Overflow or by neutrino
Published on 2010-05-18T07:58:49Z Indexed on 2010/05/18 8:00 UTC
Read the original article Hit count: 243

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 still 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?

© Stack Overflow or respective owner

Related posts about android

Related posts about android-sdk