1. 12. Map
Oum Saokosal
Master of Engineering in Information Systems, South Korea
855-12-252-752
oum_saokosal@yahoo.com
2. Map
• Google owns Android, so it is obvious that
the map you're going to use in Android
app must be Google Map.
• However to use Google Map in your app
is not as easy as it should be.
3. Instruction how to make Map app:
1. Go to window menu -> Android SDK Manager
-> Download Google API (2.3.3 API 10)
4. 2. Create AVD Targeting
Google API:
For this map app, you
need to create an AVD
targeting Google API. In
this case, please choose
API level 10 for 2.3.3.
16. 7. Enter the API key into main.xml.
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mymap"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="eNtEr_y0uR_Ap1_kEy_HeRe"
/>
17. 8. In Java, you must extends MapActivity instead of Activity:
package com.kosalab;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.os.Bundle;
public class GoogleMapActivity extends MapActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MapView mapView = (MapView) findViewById(R.id.mymap);
mapView.setBuiltInZoomControls(true);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
18. • Run the App with the AVD targeting Google API
19. You know what, you have
reached the end of this course!
Thank You Very Much
Good Luck!
From Prof. Oum Saokosal
On Feb 1, 2012