Page 107 - 24JAM_Pintar_Pemrograman_Android__1-libre
P. 107
24 JAM!! Pintar Pemrograman Android
maka marker akan berpindah ke lokasi baru, diikuti animasi
sederhana map bergeser mengikuti marker sekaligus
melakukan zoom. Perhatikan Gambar 15.1.
(a) (b)
Gambar 15.1. Kombinasi map, marker dan GPS ,(a)
DDMS untuk emulator GPS, (b) Map dan markernya
1. Bikin project baru lagi
Project name mapMarkerGps
Build Target Android 2.2
Aplication name Google Map
Package name Com.map.marker
Create Activity MapMarker
Min SDK version 8
2. Masukkan gambar marker/pin ke drawable
3. Main.xml
1: <?xml version="1.0" encoding="utf-8"?>
2: <RelativeLayout
3: xmlns:android="http://schemas.android.com/apk/res/android"
4: android:orientation="vertical"
5: android:layout_width="fill_parent"
6: android:layout_height="fill_parent">
7:
8: <com.google.android.maps.MapView
9:
xmlns:android="http://schemas.android.com/apk/res/android"
10: android:id="@+id/map_view"
11: android:layout_width="fill_parent"
12: android:layout_height="fill_parent"
13: android:clickable="true"
14: android:enabled="true"
15: android:apiKey="0CyuBP8zNhMbsh0kiDX7go-
37s8g81rYQQoldrQ" />
16: </RelativeLayout>
17:
Dapatkan materi terbaru di 107
www.omayib.com

