Android Error to get location
Android Error to get location
Hello I want to get location but it is not loading.
My class for load location:
public class GetGPCAdress implements LocationListener {
Activity activity;
GetAdress getAdress;
public GetGPCAdress(Activity activity, GetAdress getAdress) {
this.activity = activity;
this.getAdress = getAdress;
try {
LocationManager locationManager = (LocationManager) activity.getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1, 5, this);
}
catch(SecurityException e) {
e.printStackTrace();
}
}
@Override
public void onLocationChanged(Location location) {
getAdress.get_gpc_address(location.getLatitude(), location.getLongitude());
}
....
and from activity i run it
private void load_locatio () {
Log.d("NekTest", "StartLoadLocation");
new GetGPCAdress(activity, new GetGPCAdress.GetAdress() {
@Override
public void get_gpc_address(Double lat, Double log) {
my_latitude = lat;
my_logtitude = log;
Log.d("NekTest", "AddressTook");
open_dialog();
}
@Override
public void get_full_address(String address) {
full_address = address;
}
});
}
I granted all permissions and checked it before run
and also wrote permission in the manifest file.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Welcome to StackOverflow! Please elaborate on what the issue is and what you've tried already to solve the issue. Also, have a look at this help article. Cheers :)
– vatbub
Jun 30 at 23:52