About a month ago, beta testers of JavaRanch’s JForum implementation told me the iPhone and the Droid had a large blank column on the right side of the screen. Hence needing an emulator to try to fix it. (This all happened weeks ago – just didn’t get around to blogging about it.)
Note: I didn’t install the Android Eclipse plugin because I’m not doing BlackBerry development. If you want the plugin, you can install the toolkit.
Steps to download the simulator
- Download the SDK for your platform from the Android download site.
- Run “SDK Setup” executable from the download
- Choose the required available packages for download. (I wasn’t sure what I needed so I had downloaded all of them. You definitely need Android 2.0.) . This step took a long time to install since it downloaded at 55KB/sec – dialup speeds. I let it run overnight to completion. It probably took a few hours.
Steps to initially configure the simulator
- See what targets are available
android-sdk-windows\tools>android list targets
“Android 2.0” version 5 should be a choice. This is the Droid. The target looks like:
- Create the AVD (Android Virtual Device)
android-sdk-windows\tools>android create avd -n Droid -t 1
id: 1 or “android-5”
Name: Android 2.0
API level: 5
Skins: HVGA (default), QVGA, WQVGA400, WQVGA432, WVGA800, WVGA854
Launching and running
- Launch your local Tomcat (or other app server)
- Launch the emulator
android-sdk-windows\tools>emulator -avd Droid
- wait a while – it says “Android…” then “ANDROID” in shiny letters
- Ignore error message that says “sorry application messaging is not responding”
- Test away. Note that you must use your computer name rather than localhost. (On windows this is the %COMPUTERNAME% property.) Thanks to ASP forum for this tip.
Actually using the simulator
Some impressions of using the simulator:
- It’s great and intuitive.
- That’s it! If you read my BlackBerry post, there were a pile of things to get used to. The Droid just worked.
The trick is that the Droid and iPhone need to be told the width of the page or they assume it is larger. It’s an odd effect, but easy to solve by adding the following tag to the header.
<meta name="viewport" content="width = 320" />