How to remove custom marker from open street map and reload it again?
up vote
1
down vote
favorite
Here is my code. I can load marker using this method.But i want to load another marker at the same place, so i tried to remove older and put new one.
private void locationFind(String latitude, String longitude) {
Double latDouble = Double.parseDouble(latitudeStr);
Double lanDouble = Double.parseDouble(longitudeStr);
marker = new Marker(mapView, getContext());
marker.setPosition(new GeoPoint(latDouble - .001, lanDouble + .001));
marker.setIcon(new BitmapDrawable(createCustomMarker(1)));
marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
mapView.getOverlays().add(marker);
marker.setOnMarkerClickListener(new Marker.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(Marker marker, MapView mapView) {
marker.closeInfoWindow();
return false;
}
});
mapView.getOverlays().add(marker);
}
}
New contributor
Md. Atikur Rahman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
1
down vote
favorite
Here is my code. I can load marker using this method.But i want to load another marker at the same place, so i tried to remove older and put new one.
private void locationFind(String latitude, String longitude) {
Double latDouble = Double.parseDouble(latitudeStr);
Double lanDouble = Double.parseDouble(longitudeStr);
marker = new Marker(mapView, getContext());
marker.setPosition(new GeoPoint(latDouble - .001, lanDouble + .001));
marker.setIcon(new BitmapDrawable(createCustomMarker(1)));
marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
mapView.getOverlays().add(marker);
marker.setOnMarkerClickListener(new Marker.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(Marker marker, MapView mapView) {
marker.closeInfoWindow();
return false;
}
});
mapView.getOverlays().add(marker);
}
}
New contributor
Md. Atikur Rahman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
googleMap.clear(); and add again
– Zahoor Saleem
Nov 10 at 16:26
TrymapView.getOverlays().remove(marker)to remove the marker overlay, or remove all overlay objects withmapView.getOverlays().clear().
– elmiomar
Nov 10 at 17:35
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Here is my code. I can load marker using this method.But i want to load another marker at the same place, so i tried to remove older and put new one.
private void locationFind(String latitude, String longitude) {
Double latDouble = Double.parseDouble(latitudeStr);
Double lanDouble = Double.parseDouble(longitudeStr);
marker = new Marker(mapView, getContext());
marker.setPosition(new GeoPoint(latDouble - .001, lanDouble + .001));
marker.setIcon(new BitmapDrawable(createCustomMarker(1)));
marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
mapView.getOverlays().add(marker);
marker.setOnMarkerClickListener(new Marker.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(Marker marker, MapView mapView) {
marker.closeInfoWindow();
return false;
}
});
mapView.getOverlays().add(marker);
}
}
New contributor
Md. Atikur Rahman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Here is my code. I can load marker using this method.But i want to load another marker at the same place, so i tried to remove older and put new one.
private void locationFind(String latitude, String longitude) {
Double latDouble = Double.parseDouble(latitudeStr);
Double lanDouble = Double.parseDouble(longitudeStr);
marker = new Marker(mapView, getContext());
marker.setPosition(new GeoPoint(latDouble - .001, lanDouble + .001));
marker.setIcon(new BitmapDrawable(createCustomMarker(1)));
marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
mapView.getOverlays().add(marker);
marker.setOnMarkerClickListener(new Marker.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(Marker marker, MapView mapView) {
marker.closeInfoWindow();
return false;
}
});
mapView.getOverlays().add(marker);
}
}
New contributor
Md. Atikur Rahman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Md. Atikur Rahman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited Nov 10 at 16:23
Machavity
23.9k135478
23.9k135478
New contributor
Md. Atikur Rahman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked Nov 10 at 16:06
Md. Atikur Rahman
61
61
New contributor
Md. Atikur Rahman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Md. Atikur Rahman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Md. Atikur Rahman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
googleMap.clear(); and add again
– Zahoor Saleem
Nov 10 at 16:26
TrymapView.getOverlays().remove(marker)to remove the marker overlay, or remove all overlay objects withmapView.getOverlays().clear().
– elmiomar
Nov 10 at 17:35
add a comment |
googleMap.clear(); and add again
– Zahoor Saleem
Nov 10 at 16:26
TrymapView.getOverlays().remove(marker)to remove the marker overlay, or remove all overlay objects withmapView.getOverlays().clear().
– elmiomar
Nov 10 at 17:35
googleMap.clear(); and add again
– Zahoor Saleem
Nov 10 at 16:26
googleMap.clear(); and add again
– Zahoor Saleem
Nov 10 at 16:26
Try
mapView.getOverlays().remove(marker) to remove the marker overlay, or remove all overlay objects with mapView.getOverlays().clear().– elmiomar
Nov 10 at 17:35
Try
mapView.getOverlays().remove(marker) to remove the marker overlay, or remove all overlay objects with mapView.getOverlays().clear().– elmiomar
Nov 10 at 17:35
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Try this in the same thread
mapView.getOverlayManager().clear() ;
MapView.invalidate();
Then add..
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Try this in the same thread
mapView.getOverlayManager().clear() ;
MapView.invalidate();
Then add..
add a comment |
up vote
0
down vote
Try this in the same thread
mapView.getOverlayManager().clear() ;
MapView.invalidate();
Then add..
add a comment |
up vote
0
down vote
up vote
0
down vote
Try this in the same thread
mapView.getOverlayManager().clear() ;
MapView.invalidate();
Then add..
Try this in the same thread
mapView.getOverlayManager().clear() ;
MapView.invalidate();
Then add..
answered Nov 10 at 17:38
XnaijaZ
627
627
add a comment |
add a comment |
Md. Atikur Rahman is a new contributor. Be nice, and check out our Code of Conduct.
Md. Atikur Rahman is a new contributor. Be nice, and check out our Code of Conduct.
Md. Atikur Rahman is a new contributor. Be nice, and check out our Code of Conduct.
Md. Atikur Rahman is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240791%2fhow-to-remove-custom-marker-from-open-street-map-and-reload-it-again%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
googleMap.clear(); and add again
– Zahoor Saleem
Nov 10 at 16:26
Try
mapView.getOverlays().remove(marker)to remove the marker overlay, or remove all overlay objects withmapView.getOverlays().clear().– elmiomar
Nov 10 at 17:35