Sunday, November 23, 2008

A minimal Android application to display Map, using MapView

it's a very minimal Android application using MapView to display a Map on Android Phone.

My Setup is:
Ubuntu 8.10
Eclipse 3.4.1
Android SDK 1.0

First of All, start Eclipse and create a Android Project:
In my exercise, I use AndroidMap as the name.
Project Name - AndroidMap
Package Name - com.Android.AndroidMap
Activity Name - AndroidMap
Application Name - AndroidMap

Now you have to grant permission to the application to access internet:
Select AndroidManifest.xml in res folder from Package Window on the left. Activate Permissions tab, then Add two Uses Permission, android.permission.ACCESS_COARSE_LOCATION and android.permission.INTERNET.

In order to use MapView, uses-library, "", have to be defined inside AndroidManifest.xml. Activate AndroidManifest.xml to manual edit the xml directly, insert

<uses-library android:name="" />

inside the <Application> element. The full listing of my AndroidManifest.xml:

Save and close AndroidManifest.xml.

Modify UI, (Package Window>res Folder>layout Folder>main.xml), by replacing TextView with MapView:

android:apiKey="api_key_here" />

Please note that you MUST to insert your own "api_key_here".
In order to apply your own apiKey, you have to check your Getting the MD5 Fingerprint of the SDK Debug Certificate (for emulator), and Sign Up for the Android Maps API.

Save and close main.xml.

Finally, modify

package com.Android.AndroidMap;
import android.os.Bundle;

public class AndroidMap extends MapActivity {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {

protected boolean isRouteDisplayed() {
return false;

Save the java file.

Now you can Run the minimal AndroidMap on Emulator.

SORRY for all! Blogger re-format my code and make all the code mis-aligned, and not easy to read. I don't know how to fix it!!!

Sunday, November 2, 2008

Android Developers - Bonsai Blast

Jacob Abrams of Glu Mobile talks about they built their Android app, Bonsai Blast.