dear friends, i am trying to get current latitude and longitude and written following code given exception at getlatitude method
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) {
}
}
how to solve this issue
manifest file