Afficher la carte de Google dans mon application
salut à tous
voici mon programme
tout va bien sauf que la carte ne s'affiche pas
merci de m'aider
*********java*********
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| package com.android.map;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
public class HelloGoogleMapActivity extends MapActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
protected boolean isRouteDisplayed()
{
return false;
}
} |
*****main.xml************
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
<?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="@string/mapKey"
/>
</LinearLayout> |
************string.xml*************
à noter que j'ai tapé mon clé API au lieu de xxxxxxxxxxxxxxxxxx
Code:
1 2 3 4 5 6 7
|
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, HelloGoogleMapActivity!</string>
<string name="app_name">GoogleMapTuto</string>
<string name="mapKey">XxxxxxxxxxxxxxxxxxxxxxxxxX</string>
</resources> |
************manifest******************
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.map"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-library android:name="com.google.android.maps" />
<activity android:name=".HelloGoogleMapActivity"
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-permission android:name="android.permission.INTERNET" />
</manifest> |