Thursday, August 9, 2012

Emulating the Nexus 7 Display Properties

Ahh the new Nexus 7 tablet is a sweet piece of hardware! On top of that, it's selling like mad. Are you on the waiting list, but need to make sure your apps are ready for it? This blog post is about creating an emulator image to emulate the display of the Nexus 7.

Before we start, please read the Android developer blog post on getting ready for Nexus 7. It's a good start to our discussion. Getting Your App Ready for Jelly Bean and Nexus 7.

Now that you're up to date, you know the new tablet is one of the first to sport the tvdpi screen density. If your app isn't ready for it, you might be in trouble. So, what do we need to do to set up an emulator for this density?

  1. Open AVD Manager and create a new virtual device named "nexus_7".
  2. Unless you have set up the hardware accelerated emulator set the "Target:" to Android 2.3.3. This will run fast enough to test your apps for the display. Note that you're not creating a real Nexus 7 emulator but this will be sufficient to test your app for the display! If you really want to test Jelly Bean, you'll want to set up the hardware acceleration for your emulator. Hopefully we'll discuss that in another blog post.
  3. Set up a sufficient SD card size. 
  4. Under "Skin:" choose resolution and specify the Nexus 7 resolution of 720 x 1280. Note that we put 720 first because we want the emulator to start up in portrait mode just like the device.
  5. Under "Hardware:", choose an Abstracted LCD density of 213. This is tvdpi!
Now you're set! When you start the emulator you will probably want to set the Launch Options to scale the display to 8 inches, especially if you're on a laptop screen. Now you should be able to test your layouts for the new Nexus 7. Have fun.