Hi,

Don't know if this will still be useful, but here goes.

To bring up a map on the emulator I have 3 different parts:

1) A Class that extends MapActivity

Something like....

import com.google.android.maps.MapActivity;
import android.os.Bundle;

public class MapApp extends MapActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

        @Override
        protected boolean isRouteDisplayed() {
                return false;
        }
}

2) The layout file, here main.xml, should be something like....

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

<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="my_api_key"
   />

</LinearLayout>

*** Where my_api_key is your own api key.

3) And lastly there are 2 bits you will need to add to your
manifest.xml file....

a) <uses-library android:name="com.google.android.maps" /
>                      <------- This goes inbetween the <application>
</application> tags

b) <uses-permission
        xmlns:android="http://schemas.android.com/apk/res/android";
 
android:name="android.permission.INTERNET">
<------- I've put this after the </application> tag
    </uses-permission>

This might not be the quickest, best etc way to do it but it will show
a map you can pan around (look at the api if you want to add zoom
functionality)

Hope this was what you were asking for and not a waste of time haha :D
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to