Guest lebnen Posted September 20, 2010 Report Posted September 20, 2010 I am new to SW development with Android. Trying to have a MapView object in my display. Code is straightforward below. But for some reason when i launch the application i do not see any map but rather the grey grid. I have looked at many posts on the internet and i understand that it is either an INTERNET permission (which is included in my coe) or a wrong apiKey. I have gone through the apiKey several time. Am not sure what can be wrong. Any help would be great. Thanks, Lebnen. ----------------------------------------------- Manifest.xml ----------------------------------------------- <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test.testmap" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"> <uses-library android:name="com.google.android.maps" /> <uses-permission android:name="android.permission.INTERNET" /> <activity android:name=".TestMapActivity" 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> </manifest> ----------------------------------------------- main.xml ----------------------------------------------- <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainlayout" androidrientation="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:enabled="true" android:apiKey="0SA_n7tIj-klgGxARuFJgEos8FBGtEshpgmfogA" /> </LinearLayout> ----------------------------------------------- testMapActivity.java ----------------------------------------------- package com.test.testmap; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; import android.widget.LinearLayout; import com.google.android.maps.MapView; import com.google.android.maps.MapController; import com.google.android.maps.MapActivity; import com.google.android.maps.GeoPoint; public class TestMapActivity extends MapActivity { private MapView mapView; LinearLayout linearLayout; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); mapView = (MapView) this.findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true); mapView.setSatellite(true); } @Override public boolean isRouteDisplayed() { return false; } }
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now