Android UI Tutorial - Android MapView








The com.google.android.maps.MapView control can display a map.

You can instantiate this control either via XML layout or code, but the activity that uses it must extend MapActivity.

MapActivity takes care of multithreading requests to load a map, perform caching, and so on.

Example

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
// w  ww.ja v  a2 s  . co m
    <com.google.android.maps.MapView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:enabled="true"
        android:clickable="true"
        android:apiKey="myAPIKey"
        />

</LinearLayout>