Bonjour,

je suis débutant sur Android et ne sais pas vraiment comment trouver l'origine d'un plantage (stopped unexpectedly) à l'ouverture d'une appli.
Je travaille sous eclipse, où peut-on trouver des infos sur l'erreur du plantage.

Sinon le code a l'air simple, je l'ai récupéré en ligne :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
import android.app.Activity;
import android.os.Bundle;
 
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.location.LocationProvider;
 
import android.util.Log;
 
public class Test extends Activity {
	private LocationManager lm;
 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); 
        lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000l, 10l, new LocationListener(){
            public void onLocationChanged(Location arg0) {
                 String lat = String.valueOf(arg0.getLatitude());
                 String lon = String.valueOf(arg0.getLongitude());
                 Log.e("GPS", "location changed: lat="+lat+", lon="+lon);
            } 
            public void onProviderDisabled(String arg0) { 
                 Log.e("GPS", "provider disabled " + arg0); 
            } 
            public void onProviderEnabled(String arg0) { 
                 Log.e("GPS", "provider enabled " + arg0); 
            } 
            public void onStatusChanged(String arg0, int arg1, Bundle arg2) { 
                 Log.e("GPS", "status changed to " + arg0 + "-" + arg1 + "-"); 
            }
        });
 
    }
}