Monsieur, merci pour votre aide, voici le code complet de mon programme salut j'obtiens l'erreur. » Ne peut pas résoudre locationmanager.requestLocationUpdates méthode() ;Salut Je reçois l'erreur « ne peut pas résoudre locationmanager.requestLocationUpdates méthode();
public class MainActivity extends Activity implements LocationListener {
public Button button;
private TextView textView;
public LocationManager locationmanager;
Context context;
private double lat,lon;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
locationmanager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
button = (Button) findViewById(R.id.button);
textView = (TextView) findViewById(R.id.textView);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//error !!!!!!
** erreur ** locationmanager.requestLocationUpdates (LocationManager.GPS_PROVIDER, 5000,0, ce);
}
});
}
@Override
public void onLocationChanged(Location location) {
if(location!=null)
{
lat=location.getLatitude();
lon=location.getLongitude();
textView.append("\n lat:"+lat+" lon:"+lon);
}
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
}