Friday, February 25, 2011

Create Android Virtual Device (AVD)

Today topic will cover on how to create a new project in Eclipse (Helios 3.6) with develop an apps called Hello World.
Tips: You may skip any of the sentence with gray in color if you want to have a fast tutorial

*If you are a typical programmer, sure you will know what is Hello World. Hello World is the simplest program/ application that can be ran without error for testing purpose. For me, it is a program that shows the whole picture how an application works. To those who want to know more, this is a full description for it.

Todo List
  1. Create Android Virtual Device(AVD) - one AVD can be used for all applications
  2. Create New Project
  3. Insert programming coding to shows Hello, World! using HelloWorld.java
1. Create Android Virtual Device(AVD)
  • In Eclipse, choose Window > Android SDK and AVD Manager.
  • Choose Virtual Device in the left panel and click the New button at the top right.
    A Create new Android Virtual Device (AVD) window will pop up.


  • Type Name such as myavd, select target (i personally choose Android 2.1-update, this is the Android version you want to run in your emulator)
    All other boxes below can let it as default, then click Create AVD


  • Click on the created AVD (myavd) and click Start... if you want to run the emulator. It took me more than two minutes to boot up the emulator using my fsl (f**king slow laptop)! Hopes that it is not happen to your pc, if not, just please be patient.

Friday, February 18, 2011

Add / Open SDK ApiDemos work with your Android emulator - Eclipse

After we download the Android SDK package, we know it contains lots of subfolder inside until we decided to ignore it. But do you know that actually it contains a lot of tutorials, sample coding and documentations inside the android-sdk-windows folder?

Today I want to log on how to open the Android API Demo in [Dir]\android-sdk-windows\samples\android-8\ApiDemos
And then install into your emulator so that you can test/try everything they provided.

The end result you should see something like this.


Go to File>New>Android Project and click it.



A pop up screen will be prompt for you to add new project.
You have to insert the project name as you like ApiDemos for example.
1. Select Create project from existing source
2. Check Android 2.2 (for api 8, version 2.2 is enough)
3. You must select the folder which contains AndroidManifest.xml build and run purposes


So look for the "Browse..." button and for the sample folder in android-sdk-windows, the AndroidManifest.xml for apidemo 8 located at android-8>ApiDemos


And then click Finish. Once the file is completely import into Eclipse, now we have to run it.

Notes: Initially, the ApiDemos folder will not contains the android packet (*.apk), so you have to run atleast once in Eclipse. So you may install the *.apk straight away either in the device or for future use without running it again using any IDE.


Look for the ApiDemos.java within src>com.example.android.apis


After Open it, then Run the file using the icon on the top of the application.

Run as the Android Application and click OK.


Notes: Once you click OK, Eclipse will auto search for the most suitable AVD - Android Virtual Device (track by api Level and android version) that you created to install this application.
















If the system found that no match in the list, a pop up screen will ask you to create a new AVD with suitable api.

In this case, we use level 8 api. Please click yes to link in to the avd manager or you can find in the toolbar on the top (same row with the Run icon, the icon with a white arrow pointing downwards)
To create AVD, please follow this link - Create AVD

After AVD creation, kindly close the window, a another screen will ask you to choose a suitable AVD, click the refresh button and choose the AVD you have just created.
(You may facing some unknown problem if your computer is out of memory, so please go to the avd manager, start and launch the emulator yourself, close it and open the second time if the Not Responding problem still happening, Cause recently i'm facing this problem)

Yes, unlock the screen, and tap the application icon, now mostly you may get to the page..