How to get the location or address from the google map when i am click on a particular address. IS it possible to use map overlay to collect the address from the map view.
Asked
Active
Viewed 1.4k times
4
-
belove link help you how to get location address from google map ..try it http://stackoverflow.com/questions/2084065/get-map-address-or-location-address-in-android – Hemantvc Nov 28 '12 at 05:53
1 Answers
12
Please Use below code for get address.
try {
Geocoder geo = new Geocoder(youractivityclassname.this.getApplicationContext(), Locale.getDefault());
List<Address> addresses = geo.getFromLocation(latitude, longitude, 1);
if (addresses.isEmpty()) {
yourtextfieldname.setText("Waiting for Location");
}
else {
if (addresses.size() > 0) {
yourtextfieldname.setText(addresses.get(0).getFeatureName() + ", " + addresses.get(0).getLocality() +", " + addresses.get(0).getAdminArea() + ", " + addresses.get(0).getCountryName());
//Toast.makeText(getApplicationContext(), "Address:- " + addresses.get(0).getFeatureName() + addresses.get(0).getAdminArea() + addresses.get(0).getLocality(), Toast.LENGTH_LONG).show();
}
}
}
catch (Exception e) {
e.printStackTrace(); // getFromLocation() may sometimes fail
}
And see below link for more information and complete example.

Dipak Keshariya
- 22,193
- 18
- 76
- 128