Saturday, 22 August 2009

A minimal Map application using MapActivity, with Android 1.5 SDK r3.

OS: Ubuntu 9.04
Java: Sun JDK 6
Eclipse version: 3.5 Galileo
Android SDK: Android 1.5 SDK r3

It's a very minimal Android Application to display MapView.

Actually, this exercise follow the tutorial, Hello, MapView, with more pictures to describe.

Create a Android Application HelloMapView.


Modify AndroidManifest.xml:
Add <uses-library android:name="com.google.android.maps" /> as a child of the <application> element.
Add <uses-permission android:name="android.permission.INTERNET" /> a child of the <manifest> element.


Modify main.xml to add a MapView.


You have to Obtaining a Maps API Key, and insert into the field "apikey"

Modify HelloMapView to extends HelloMapView from MapActivity, and also override isRouteDisplayed().


You can actually run this now, but all it does is allow you to pan around the map.


The project files can be downloaded here. Please note that you cannot run the application directly, you have to insert your own apikey, in order to make it work.

No comments:

Post a Comment