android - Get the particular address using latitude and longitude -
i need know there api ,from can receive address of current place.using location manager have receive latitude , longitude of current place ,but need address.
i have tried below api.
http://maps.googleapis.com/maps/api/geocode/json?latlng="+ lat + "," + lon + &sensor=true"
but not showing exact place .can me.@thanks
from geocoder object, can call getfromlocation(double, double, int) method.
like :-
private string getaddress(double latitude, double longitude) { stringbuilder result = new stringbuilder(); try { geocoder geocoder = new geocoder(this, locale.getdefault()); list<address> addresses = geocoder.getfromlocation(latitude, longitude, 1); if (addresses.size() > 0) { address address = addresses.get(0); result.append(address.getlocality()).append("\n"); result.append(address.getcountryname()); } } catch (ioexception e) { log.e("tag", e.getmessage()); } return result.tostring(); }
another best answer here how city name latitude , longitude coordinates in google maps?
Comments
Post a Comment