문제

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

도움이 되었습니까?

해결책

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);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top