i have made an application in which i need to change the drawable of an overlayitem when a user clicks on it. i am using the following code to achieve this effect:
This is very simple to do:
protected boolean onTap(int index) {
OverlayItem item = mOverlays.get(index);
//Get the new Drawable
Drawable marker = mContext.getResources().getDrawable(R.drawable.icon);
//Set its bounds
marker.setBounds(0,0,marker.getIntrinsicWidth(),marker.getIntrinsicHeight());
//Set the new marker
item.setMarker(marker);
//Return true! Do not invalidate
return true;
}