Я пытаюсь получить ток долго, лат. Я получаю Nullpointer на
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
LocationListener myLocationListener = new CurrentLocationListener();
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1, 1, myLocationListener);
Location currentLocation = locationManager.getLastKnownLocation("gps");
Latitude = currentLocation.getLatitude(); ----->>> null pointer exception here
Longitude = currentLocation.getLongitude();
public class CurrentLocationListener implements LocationListener{
public void onLocationChanged(Location argLocation) {
}
public void onProviderDisabled(String provider) {
}
public void onProviderEnabled(String provider) {
}
public void onStatusChanged(String provider, int status, Bundle arg2) {
}
}
Мой файл манифеста
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>