CHAPTER 7: Making Apps Interactive: Intents, Event Handling, and Menus 217
When I used the Run As ➤ Android Application menu sequence, the Nexus One AVD launched,
and the default Android (installed) OS application icons appeared, but the Hello Universe icon was
nowhere to be seen, and the application start-up screen (MainActivity.class or MainActivity.java) did
not show up, as it should have during a normal code-compile-AVD-test development cycle.
For this reason, I am going to add a section into this chapter here, much as I did in the previous
chapter when I opened up Eclipse and got a gaggle of nasty red error highlights that were not even
my fault! I will do this to show you what I do when the Eclipse AVD emulator “stalls,” and does
not complete its “lifecycle” and perform its necessary AVD emulation duties. Bad Emulator! Next,
I am going to show you how I get around this emulator breakdown scenario, and how I get the
AVD emulator to restart “from scratch,” so that it will load the application, and then auto-launch
the application in the way that it is supposed to launch the application for testing in the first place.
After that, we will continue on exploring the MenuInflater class, as if this AVD glitch had never even
occurred.
AVD Is Not Starting App: Using the Eclipse AVD Manager
To solve the “hung” AVD problem, I used Eclipse’s Run ➤ Android Virtual Device Manager menu
sequence, and opened up the Android Virtual Device Manager dialog shown in Figure 7-3. I
selected a Nexus One AVD by clicking on it (it turns blue, as shown), and then clicked on the Start
button. A Launch Options dialog pops open, with two selected (checked) options; Launch from
snapshot and Save to snapshot. I then de-selected, or un-checked, these two options, as shown
on the right-hand side of Figure 7-3, and I clicked on the Launch button.
Figure 7-3. Use the AVD Manager’s Start button, then deselect the snapshot options, before using the Launch button
This work process will launch the AVD “from scratch,” and you will see the silver ANDROID logo
“loader animation” reloading the AVD into your system memory anew (afresh?), which should “reset”
or “restore” the connection between the AVD and the auto-loading of your project data into the
emulator for auto-starting and testing.