March 2013
Beginner to intermediate
580 pages
16h 11m
English
The onSaveInstanceState(Bundle) is another tool you have used to handle rotation. In fact, if your app does not have any problems with rotation, it is because the default behavior of onSaveInstanceState(…) is working.
Your CriminalIntent app is a good example. CrimeFragment is not retained, but if you make changes to the crime’s title or toggle the check box, the new states of these View objects are automatically saved out and restored after rotation. This is what onSaveInstanceState(…) was designed to do – save out and restore the UI state of your app.
The major difference between overriding Fragment.onSaveInstanceState(…) and retaining the fragment is how long the preserved data lasts. If ...
Read now
Unlock full access