January 2014
Intermediate to advanced
736 pages
70h 43m
English
Fragment method onSaveInstanceState (Fig. 8.47) saves the selected contact’s rowID when the configuration of the device changes during the app’s execution—for example, when the user rotates the device or slides out a keyboard on a device with a hard keyboard. The state of the GUI components is saved for you automatically, but any other items that you wish to restore during a configuration change should be stored in the Bundle that onSaveInstanceState receives.
105 // save currently displayed contact's row ID106 @Override107 public void onSaveInstanceState(Bundle outState)108 {109 super.onSaveInstanceState(outState);110 outState.putLong( ...
Read now
Unlock full access