Sunday, September 5, 2010

Getting started with Tablets - They are coming

So, Android phones are done. Now's the time to give the iPads a rest. If you would like to develop applications for Android Tablets, you need to get a few things up first.

First of all, you need to setup a few tablet emulators for your apps. This bit is rather simple. Create a new AVD. I guess this screenshot explains the rest. For some reasons, I have not been able to create Tablet AVDs on 1.6. But it definitely works on Android 2.2 (Froyo).

After you create this AVD, fire it up. And you should be able to see the Droid up and jumping.

You can now test out your apps on this tablet emulator. Well, since tablet devices will obviously come under large-screens, to make your designing layouts for large screens easy, you need to tweak up a few things on eclipse. Since, large screen devices take up the xml layouts from the "layout-large" and "layout-large-land" folders, if it all you have different layouts for large screens, to visualize your designs during your development, you need to add one more configuration for large screens.

Steps to add a new configuration

- Open eclipse. Open any layout xml, so that you can get to the screen where you can add a custom configuration.


- In the devices drop down, select custom to create a new configuration. Click on "Create" which will open up the configuration screen.

- On the new configuration screen, select "Nexus One" and click on "Copy" to create a copy which you can edit later.


- Once you get a copy, you can rename it to your own configuration name.

- Before you are done, you need to change a few values for both the layouts, landscape and portrait. Follow the screen shot.


Change x dpi, y dpi, Screen Size, Resolution and set it to values as shown above. Do it for both the orientations.

- Save the configuration. Now, whenever you change the configuration to your custom config, since this custom config is for the large screen devices, it would show you how your layouts will look on a real device. It will pick up the xml files correctly whenever you switch your configuration to large screens.