Thursday 8 July 2010

Developing with the Android Emulator: the Beginning

The documentation on Android Developers is very well done, but there is a lot of informations. Often the informations I need are spread over many different pages.

A quick setup for the development environment is easy to find. There is a lot of good sources about how to setup the virtual device, how to create a new project using the IDE and so on. What I missed is a collection of practical advices.

Don't Restart

The first mistake I did was to stop the emulator after every test of the App. Since the emulator takes very long to restart my productivity was really low. Using Eclipse and the ADT plug-in, it is sufficient to re-run the configuration: the ADT prepares the new version of the App and installs it on the emulated device. This way testing and debugging is easy and efficient.

Play with the Emulator

The my second mistake was to start with the development before I did really understand the environment.

The state of the emulation may be changed using predefined keyboard shortcuts. This is really useful.

The application will support a wide range of devices if you test it with 2 or 3 different profiles.

I defined three profiles: small, medium, and large.  Small is a device without touch, without SD card and with less memory. Medium is a device with a 320x480 touch screen, 1GB SD card and 512MB memory. Large is a device with a 480x800 touch screen, 4GB SD card and 576MB memory.

First create the SD card (100 MB should be enough) and than fill the profile form. I use dimensions and not a predefined screen type.  Additionally I set up the screen resolution and the device memory. Both are properties to add at the end if the profile form.

Name: Small; Target: Android 1.5 - API Level 3; Resolution: 240x320; Properties: Abstracted LCD Density = 120, Device ram size = 96.

Name: Medium; Target: Android 1.5 - API Level 3; Resolution: 320x480; Properties: Abstracted LCD Density = 160, Device ram size = 512.

Name: Large; Target: Android 2.1 - API Level 7; Resolution: 480x800; Properties: Abstracted LCD Density = 240, Device ram size = 576.

The Note Pad sample may be used to play with the emulator and to discover the development environment. At the beginning don't try to understand the code. Place two or three break points and start to debug the application. This way you will quickly familiarize with Android.

Keep in mind that the emulator does many things but doesn't replace a true device. For example: the emulator cannot vibrate.

Posted via Blogaway

1 comment:

  1. This is one of the valuable post.Nicely you describe about Android.This is one of the good collection.I like this post.Android app developers

    ReplyDelete