简体   繁体   中英

Google map api:geo location + custom markers

如何添加 1.geo location 2.load the marker name into a textbox on click my code http://pastebin.com/DUNgyfBD

if this is on android studio then heres how you place a marker on the map, tinker on it for infowindow

 mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
        @Override
        public void onMapClick(LatLng point) {
        try {
                //place marker where user just clicked
                marker = mMap.addMarker(new MarkerOptions().position(point));
                LatLng latLng = marker.getPosition();
                double latitude = latLng.latitude;
                double longitude = latLng.longitude;

                Geocoder geocoder;
                addresses = null;
                geocoder = new Geocoder(getBaseContext(), Locale.getDefault());


                addresses = geocoder.getFromLocation(latitude, longitude, 1);
            } catch (IOException e) {
                e.printStackTrace();
            }
       }
   }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM