P
P
powercot2015-05-10 22:01:07
Android
powercot, 2015-05-10 22:01:07

How to move and remove markers on Google maps?

I am writing an application that uses many markers on Google maps, 2 questions arose:
How to move the marker to new coordinates?
How to remove a specific marker?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
powercot, 2015-05-12
@powercot

Thank you, I figured it out myself.

final Marker asd = mMap.addMarker(new MarkerOptions()
                .position(new LatLng(0, 0))
                .flat(true)
                .title(String.format("123")));

        mMap.setOnMyLocationChangeListener(new GoogleMap.OnMyLocationChangeListener() {
            @Override
            public void onMyLocationChange(Location location) {
                
                LatLng ttt = new LatLng(location.getLatitude(), location.getLongitude());
                asd.setPosition(ttt);
            }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question