Friday, December 17, 2010

Emulating... Emulating...

 If you're neither a) fabulously wealthy or b) a terrific shoplifter, at some point you have to use the emulator to test out things on different device sizes. Great.

the AVD Manager lets you create a bunch of virtual devices that you can test your app on. There are built in device targets with self-explanatory names such as QVGA, HVGA and WQVGA. yuck. I prefer a more readable nomenclature:


so for example, an AVD named "low-small-240-320"  is a low-density (120 dpi), small-resolution device that is 240 x 320 pixels. I created a bunch of thest, and just went to town, running my app on each.

Now an app can look great all blown up in the Android emulator with default settings, but how would it look in the real device in your hand? Fortunately the emulator lets you scale to the real device size- you simply have to know 1) your monitor's size, 2) your monitor's current resolution, and 3) your device's diagonal length. For example I have a 15.6" monitor set at 1366x768, and my device is a Samsung Moment (old, I know... see shoplifter/millionaire comment) with a 3.2 inch diagonal screen. Add those settings to the AVD parameters, and you are good to go.

Side note... your desktop monitor is probably further away from your face than your device will be. Before
you pre-judge your app's fonts in the emulator as too small, lean in a bit :-)

Finally, I recommend you test your app in both portrait AND landscape mode: while running the app, enter Ctrl-Fn-F11 to switch to landscape. You might be (un)pleasantly suprised:

aargh... was so perfect before. Now get back to work and fix your app.

No comments:

Post a Comment