Community

Topic: Geo Augmented Markers

Set Marker Image Per GeoElement (SOLVED)

ilyes hachani
Wednesday, March 14, 2018

Is it possible to use a different Image for different markers?
I am using the Android SDK. I update the Marker extending `MarkerViewAdapter` and Passing it to the `initGeoFragment` method. But that updates all the markers.
Thanks

user profile image
Support Team  (expert)
Friday, March 16, 2018

Hi,
when you have got the ImageView in the getView and getSelectedView methods you can substitute the resource you want by verifying, using the id, on which geoElement you are, you can also give the same name to groups of geoElement to make sure you have some kind of categories.
For example:

@Override

public View getView(GeoElement geoElement)
{
ImageView imageView = (ImageView)getMarkerView().findViewById(R.id.image);
if (geoElement.getName().equals("restaurant"))
imageView.setImageResource(R.drawable.map_marker_yellow);
else if (geoElement.getName().equals("park"))
imageView.setImageResource(R.drawable.map_marker_orange);
imageView.invalidate();
return getMarkerView();
}

ilyes hachani
Friday, March 16, 2018

Seems to solve my problem. Thanks.

Sign in to add a comment