My problem is that I have an Activity that when you push a button a Timer start to count, and in the same moment gets the coordinates and save it into a variable. Then when you push another time the button the timer stop and get a new coordinates and save it in an other variables.
Then I'm doing inverse geocoding with this code:
private void tradueixpos() {
Geocoder geoCoder = new Geocoder(this, Locale.getDefault());
try {
Log.v("e", String.valueOf(latituteField));
Log.v("e", String.valueOf(longitudeField));
List<Address> Locat = geoCoder.getFromLocation(latituteField, longitudeField, 1);
if (!Locat.isEmpty()) {
Address address = Locat.get(0);
result = address.getAddressLine(0) + ", " + address.getLocality();
//number = address.getSubThoroughfare();
//streetName = address.getThoroughfare();
//Log.v("e", number+", "+streetName);
}
else {
Log.v("error", "no trobat");
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
So after that it pass the Initial address and the final address to another activity.
My problem is that it return null or sometime it didn't work, an all the time is getting some errors. The geocoding is not working I think.
(I'm working with api 15)
I put the permissions, so is anyone able to help me to do this??
thanks