Question

There's an option to right click in Google Maps in the browser and select "What's here?". The result is either a street address or a suburb etc. Is it possible to implement similar functionality in Android Google Maps API V2? Would be cool to add the result as a title to a marker. Thanks

Était-ce utile?

La solution

Basically "whats's here" return address detail related to that particular latitude and longitude. So for that you can use below code and yes it good to be add result to InfoWindowAdapter

Geocoder geocoder;
List<Address> addresses;
geocoder = new Geocoder(this, Locale.getDefault());
addresses = geocoder.getFromLocation(latitude, longitude, 1);

String address = addresses.get(0).getAddressLine(0);
String city = addresses.get(0).getAddressLine(1);
String country = addresses.get(0).getAddressLine(2);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top