When creating a map application for Android device, you have to use the Google APIs by Google Inc as I have mentioned in a previous post .This Google APIs includes maps.jar in addition to android.jar. The maps.jar contains the following classes which are necessary in creating a map application.
MapActivity, MapController, MapView, Overlay, OverlayItem, ItemizedOverlay, GeoPoint etc.
Important points in creating a Map application
- Need to extend MapActivity instead Activity for the main class.
- Need to update the AndroidMainfest.xml with following tags.
- <uses-permission android:name=”android.permission.INTERNET”/>
- <uses-library android:name=”com.google.android.maps”/>
- Need to add <com.google.android.maps.MapView> tag to the xml file
<com.google.android.maps.MapView
android:id=”@+id/mapView”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
android:enabled=”true” android:clickable=”true”
android:apiKey=”0l4sCTTyRmXTNo7k8DREHvEaLar2UmHGwnhZVHQ”
/>