For the More Curious: Testing onSaveInstanceState(Bundle)

If you are overriding onSaveInstanceState(Bundle), you should test that your state is being saved and restored as expected. This is easy to do on the emulator.

Start up a virtual device. Within the list of applications on the device, find the Settings app (Figure 3.14). This app is included with most system images used on the emulator.

Figure 3.14  Finding the Settings app

Finding the Settings app

Launch Settings and select Developer options. Here you will see many possible settings. Turn on the setting labeled Don’t keep activities, as shown in Figure 3.15.

Figure 3.15  Don’t keep activities ...

Get Android Programming: The Big Nerd Ranch Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.