If you create the app described in this tutorial http://developer.android.com/resources/tutorials/views/hello-datepicker.html
change the date, and then rotate the device, you will notice the following:
The app’s textview date resets as expected (since the activity is destroyed and recreated), but if you then hit the “change the date” button, the date that you set prior to the rotation is retained. The SDK documentation discourages using onConfigChanged=”orientation|screenSize” to catch the orientation change, so my question is: what is the “best” way to keep the datepicker’s default consistent with the member variables that are used in one’s app? I don’t much care if the values of the member variables get retained, or if the picker gets reset to today’s date along with them, but the inconsistency looks sloppy to me.
If you create the app described in this tutorial http://developer.android.com/resources/tutorials/views/hello-datepicker.html change the date, and
Share
You can save your
DatePickerDialogmember variables inonSaveInstanceState, then restore them ononCreate. Something like: