Note that there are some explanatory texts on larger screens.

plurals
  1. POError with gps android
    primarykey
    data
    text
    <p>I have a GPS error in my app when I am trying to get my current location, by gps or by network</p> <pre><code>private static LocationManager lm; private static LocationListener locationListener; private static Location posicion; private double latitud; private double longitud; posicion = ObtenPosicion(); latitud = posicion.getLatitude(); longitud= posicion.getLongitude(); //Me centro en el mapa final GeoPoint yo = new GeoPoint((int)(latitud),(int)(longitud)); public Location ObtenPosicion(){ if (lm == null) { lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationListener = new LocListener(); if (lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) { lm.requestLocationUpdates( LocationManager.GPS_PROVIDER, LOCATION_UPDATE_TIME, LOCATION_UPDATE_DISTANCE, locationListener); posicion = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); } if (lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { lm.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, LOCATION_UPDATE_TIME, LOCATION_UPDATE_DISTANCE, locationListener); posicion = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); } } return posicion; } private class LocListener implements LocationListener { @Override public void onLocationChanged(Location loc) { posicion.set(loc); } @Override public void onProviderDisabled(String provider) { } @Override public void onProviderEnabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } } public static Location getCurrentLocation () { return posicion; } public void stopLocationListening () { if (lm != null) lm.removeUpdates(locationListener); } </code></pre> <p>The error is a nullpointerexception in a line :</p> <pre><code>12-06 17:04:25.418: E/AndroidRuntime(4744): java.lang.NullPointerException 12-06 17:04:25.418: E/AndroidRuntime(4744): at com.rbrlnx.lugares.editarLugar$LocListener.onLocationChanged(editarLugar.java:215) </code></pre> <p>I tried with a different codes but its me impossible..</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload