Afficher une carte google maps
Bonjour,
je suis un débutant dans la programmation sous android,je souhaite afficher la carte google maps ,en utilisant mapfragment
bon voila je vous montres mes code,je souhaite que vous puissiez m'orienter ,afin que je puisse résoudre mon problème merci
Mon fichier java :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| package com.android.googlemapsali;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
public class GoogleMapsAga extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_google_maps_aga);
GoogleMap gMap = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
gMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
gMap.setMyLocationEnabled(true);
gMap.getUiSettings().setCompassEnabled(true);
Log.e("Maps", "------EOC-------");
}
} |
Le fichier manifest :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.googlemapsali"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="com.android.googlemapsali.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.android.googlemapsali.permission.MAPS_RECEIVE" />
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<uses-permission
android:name="com.android.googlemapsali.permission.MAPS_RECEIVE"/>
<uses-permission
android:name="android.permission.INTERNET"/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission
android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:largeHeap="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
<uses-library android:name="com.google.android.maps" />
<activity android:name="com.android.googlemapsali.GoogleMapsAga"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="key" />
</application>
</manifest> |
fichier layout
Code:
1 2 3 4 5 6
| <?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" /> |
afficher une carte google maps
au fait l’émulateur se lance ,puis certain moment je reçois un message ""process not responding "
voila j'ai pu voir les erreur au niveau du log, mais j'arrivais pas comment et par quoi je doit commencer pour résoudre ses erreurs
3 pièce(s) jointe(s)
afficher une carte google maps
bon voila les erreurs du fichier log en pièce jointe ,j'ai du le fractionné en trois partie car sa taille est grande
voila j'attends vos suggestions
merci