Android map v2 : Marker display order - android

I'm writing an android app using v2 of the maps API. I have a couple of different types of markers being displayed on the map, one of which I always want to be shown over the others.
I've tried adding that marker to the map last, but it still seems to end up with other markers being displayed over the top of it depending on the relative position of the markers.
Does anyone have a way of forcing a given marker to always be shown on top?

The way to bring an item to the front is by calling .showInfoWindow();
Check out this post on how to bring a clicked item to front.
Google Maps v2 Marker zOrdering - Set to top

Related

How to set marker Z-index on MapBox Android?

My app shows a user marker. Basically, the user marker shows where the current user is on the map but I also have other markers placed on the map. In the end, it covers up my user marker. I want my User Marker to be on the top of the map. I want it to be rendered last so it shows on the very top.
Any idea?
In case anyone is looking for a newer answer for latest SDKs.
Mapbox Marker class is now deprecated in newer versions of Mapbox Android SDK. Annotations plugin is suggested instead, which has a Symbol class for markers.
In mapbox-android-plugin-annotation-v7 library Symbol class had a withZIndex() method which allowed to manipulate Z-ordering of map objects.
In mapbox-android-plugin-annotation-v8 this method was renamed to withSymbolSortKey() (which was a bit tricky to find and discover).
There is a solution from here https://github.com/mapbox/mapbox-gl-native/pull/5294
If you use MarkerView, you can bring your marker to the very top with MarkerViewManager#select call.
mapboxMap.getMarkerViewManager().select(marker);
It will end by calling View#bringToFront from Android View API, the selected marker view will show on top of all other marker views.
I think this may help:
Mapbox Android SDK: Bring marker to front
Yes. Starting with Mapbox Android SDK v4.1, the selected marker will
come to front.
You can select a marker with mapboxMap.selectMarker(marker);

Markers clustering in android gmaps v2

I am trying to implement marker clustering in android in a repeated way i.e. locations are being fetched from sql server and points are placed on map. But the problem i am facing is that the markers newly plotted or updated are not shown itself, I have to zoom in or out to see the updated markers. I have used
mclusterManager.clearItems()
but still same thing is happening. Any solution??
You need to force a recluster after adding new items doing
mclusterManager.cluster();

Android Google Maps Info window

I have to add multiple markers on map , and show their info windows at the same time .
When i add the last marker the previous info window markers automatically gets hidden.Can anyone tell me any solution how can i do this?
That is not possible with InfoWindows as noted by the 2nd sentence on this page. You might try using this library to instead put the text you would be displaying in the InfoWindow in the Marker itself. Be careful with showing too much information on the screen at once, don't want it to get too busy!

How to implement custom interactive balloon(infowindow) on maps api v2?

My question is simmilar to this.
The main difference is that i have to implement InfoWindow (also interactive) not only for markers but for any point on the map which user taps(in particular polygons and polylines).
Is there any suitable solution like BalloonItemizedOverlay for v1?
When user clicks on a map and your OnMapClickListener.onMapClick is called, simply create a Marker with 0 by 0 pixels icon and force showing info window with marker.showInfoWindow().

How Google Maps Android API v2 handle markers outside the view are

During the CameraChange event I add new markers to the map, so I want to know if they are removed automatically when they become invisible as the camera has moved.
Does anyone have this information?
Do you mean, are markers removed when the map is panned such that the marker is no longer on the screen? If so, the answer is no, the markers are still "on the map" even when "off screen".
If you would like to remove markers as they are moved off the map, please see my answer to this question

Categories

Resources