To get the resource:
getResources().getIdentifier(icon,"drawable", getPackageName())
The icon
used above is assigned variable for the XML icon
attribute
Use this to get the icon
dynamically:
.icon(BitmapDescriptorFactory
.fromResource(getResources().getIdentifier(icon,"drawable", getPackageName()))