android - Get the Location Name in onLocationChanged(Location location) method -
i want location-name inside onlocationchanged(location location)()
method. can latitude
, longitude
onlocationchanged(location location) location.getlatitude();
, location.getlongitude();
but need location name. has no method of getting location name. can that?
i doing in way :
public void onlocationchanged(location location) { double la = location.getlatitude(); double lo= location.getlongitude(); // location name? }
amar there method in geocoder class getfromlocation (lat,lng,maxresults) gives timed out exception sometimes.it has been bug geocoder. instead of calling method make request asynchronously in locationchanged callback method
@override public void onlocationchanged(location location) { new locationadressasync(this,this).execute("http://maps.googleapis.com/maps/api/geocode/json?latlng=" + location.getlongitude() + "," + location.getlatitude()+ "&sensor=true"); }
Comments
Post a Comment