I am able to display multiple overlayItems on Googlemap, now I want to change icon of any specific overlayItem (to show it is currently selected event). I want to do it through navigation buttons (next, previous) as on Google maps.
I am using StateListDrawable to display icons for OverlayItems.
Icon file is
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/selected_icon"/>
<item android:drawable="@drawable/unselected_icon"/>
</selector>
code for getMarker method of OverlayItem is as follows.
@Override
public android.graphics.drawable.Drawable getMarker(int stateBitset){
Drawable icon;
icon = this.mapActivity.getResources().getDrawable(R.drawable.film_icon);
icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
return icon;
}
Now my question is how do I change the state of any overlayItem/Icon on map when user click on one of navigation keys?
Any help is much appreciated.