Gentlemen Start Your Emulators

For most of this book I've been telling you to target your applications to version 2.2 of the Android platform (also known as FroYo). However, there's one little problem with this advice: your programs may not run on phones that have one of the older versions of Android installed.

The only reliable way of telling whether it will work is to test it. And short of buying one of every Android phone on the market, the best way to test your program on different Android versions and screen sizes is to try it in the emulator.

To do this, you'll need to set up several virtual devices with different versions and emulator skins. A skin specifies the width, height, and pixel density for an emulated device. In addition to the em22 AVD you created in Section 1.3, Creating an AVD, on page 23, I recommend that you create the following virtual devices for testing:

Name Target Skin em15 1.5 HVGA (320x480)

em16 1.6 HVGA (320x480)

em16-qvga 1.6 QVGA (200 x 320)

em21-854 2.1 WVGA854 (480x854)

em22-800 2.2 WVGA800 (480x800)

em22-1024 2.2 Custom (1024x600)

Inspired by Device...

HTC G1, Eris HTC Hero HTC Tattoo

Motorola Droid (Sholes) HTC Nexus One Notion Ink Adam

You can use the em22 AVD for development and then test your program in the other AVDs before you release the application. And don't forget to try it in both portrait and landscape modes. In the emulator, press (Ctrl+F1^ or use the Q or [9 keys on the keypad (NumLock off) to toggle between portrait and landscape.

Unless you have a very powerful desktop computer, you probably won't be able to run all these AVDs at once. In practice, I find that running only one at a time works best. Try it now by starting up the em16 (Android 1.6) emulator. Wait until the emulator comes up to the home screen, and turn off the screen lock if it appears. Now let's see some of the things that can go wrong.

0 0

Post a comment