public String getAddress(Activity
acLocal
) { String address=""; Geocoder geocoder; List<Address> addresses = null; geocoder = new Geocoder(_acLocal, Locale.getDefault()); try { addresses = geocoder.getFromLocation(lat, longi, 1); String address = addresses.get(0).getAddressLine(0); String city = addresses.get(0).getAddressLine(1); String country = addresses.get(0).getCountryName(); address = Html.fromHtml( address + "<br>" + city + "<br>" + country).toString(); } catch (Exception e) { e.printStackTrace(); address = Html.fromHtml("<br> Unable to get any address.") .toString(); }
return
address;
}
It will give you available address for respective latitude and longitude. Throws an exception if not able to convert into address
No comments:
Post a Comment
Feedback always help in improvement. If you have any query suggestion feel free to comment and Keep visiting my blog to encourage me to blogging