You need a key to access google maps, obtain the key and insert it in android:apiKey="here is my key"
There is a very good introduction how to obtain the gogle map api key on this web site Good luck -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]] Im Auftrag von Ali_pucit Gesendet: Samstag, 3. Oktober 2009 05:23 An: Android Developers Betreff: [android-developers] how to display google maps i am using android eclipse plugin for coding and try to follow hellowmapview tutorials to display google maps but nothing to display your application stopped unexpectedly force close i am using android 1.6 and google api 4 my source code is as follows package navigation.google.HelloMapView; import com.google.android.maps.MapActivity; import com.google.android.maps.MapView; import android.app.Activity; import android.os.Bundle; import android.widget.LinearLayout; import android.widget.ZoomControls; public class HelloMapView extends MapActivity { LinearLayout linearLayout; MapView mapView; ZoomControls mZoom; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); linearLayout = (LinearLayout) findViewById(R.id.zoomview); linearLayout.addView(mZoom); mapView = (MapView) findViewById(R.id.mapview); mZoom = (ZoomControls) mapView.getZoomControls(); setContentView(R.layout.main); } @Override protected boolean isRouteDisplayed() { return false; } } R . java class is as follows /* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package navigation.google.HelloMapView; public final class R { public static final class attr { } public static final class drawable { public static final int icon=0x7f020000; } public static final class id { public static final int mainlayout=0x7f050000; public static final int mapview=0x7f050001; public static final int zoomview=0x7f050002; } public static final class layout { public static final int main=0x7f030000; } public static final class string { public static final int app_name=0x7f040001; public static final int hello=0x7f040000; } } Main.xml is as follow <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:id="@+id/mainlayout" 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:clickable="true" android:apiKey="here is my key" /> <LinearLayout android:id="@+id/zoomview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@id/mapview" android:layout_centerHorizontal="true" /> </RelativeLayout> my mainfest.xml file is as <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="navigation.google.HelloMapView" android:versionCode="1" android:versionName="1.0"> <uses-permission android:name="android.permission.INTERNET"/> <application android:icon="@drawable/icon" android:label="@string/ app_name"> <uses-library android:name="com.google.android.maps" /> <activity android:name=".HelloMapView" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="3" /> </manifest> my eclipse console messages is as [2009-10-03 08:20:13 - HelloMapView]------------------------------ [2009-10-03 08:20:13 - HelloMapView]Android Launch! [2009-10-03 08:20:13 - HelloMapView]adb is running normally. [2009-10-03 08:20:13 - HelloMapView]Performing navigation.google.HelloMapView.HelloMapView activity launch [2009-10-03 08:20:13 - HelloMapView]Automatic Target Mode: Preferred AVD 'ApiMap' is not available. Launching new emulator. [2009-10-03 08:20:13 - HelloMapView]Launching a new emulator with Virtual Device 'ApiMap' [2009-10-03 08:20:22 - HelloMapView]New emulator found: emulator-5554 [2009-10-03 08:20:22 - HelloMapView]Waiting for HOME ('android.process.acore') to be launched... [2009-10-03 08:20:54 - HelloMapView]HOME is up on device 'emulator-5554' [2009-10-03 08:20:54 - HelloMapView]Uploading HelloMapView.apk onto device 'emulator-5554' [2009-10-03 08:20:54 - HelloMapView]Installing HelloMapView.apk... [2009-10-03 08:21:06 - HelloMapView]Success! [2009-10-03 08:21:06 - HelloMapView]Starting activity navigation.google.HelloMapView.HelloMapView on device [2009-10-03 08:21:13 - HelloMapView]ActivityManager: Starting: Intent { cmp=navigation.google.HelloMapView/.HelloMapView } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

