Android: Saving custom button and spinner

Posted by Jacob Huggart on Stack Overflow See other posts from Stack Overflow or by Jacob Huggart
Published on 2010-03-16T16:49:44Z Indexed on 2010/03/16 16:51 UTC
Read the original article Hit count: 268

Hello All,

I am new to Android programming and was handed a fairly large program that is almost complete, but needed support for switching between portrait and landscape view. I added android:configChanges="keyboardHidden|orientation" to the manifest and used onConfigurationChanged to save the view data and that works. However, there is a button that displays the date selected (when pressed a calendar to select the date comes up) and a spinner that displays the current view and is used to select a new view. Those two items are being cleared/reset and do not work at all after the screen flip.

I have been attempting to use onSaveInstanceState and onRestoreInstanceState to fix that, but I cannot figure out how to get it to work. Any advice?

© Stack Overflow or respective owner

Related posts about android-sdk

Related posts about screen-orientation