I am using this part of code to add a marker in a MapFragment
in Google Map Version 2.
MarkerOptions op = new MarkerOptions();
op.position(point
If you have Drawable
created programatically (so you have no resource for it), you can use this:
Drawable d = ... // programatically create drawable
Canvas canvas = new Canvas();
Bitmap bitmap = Bitmap.createBitmap(d.getIntrinsicWidth(), d.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
canvas.setBitmap(bitmap);
d.draw(canvas);
BitmapDescriptor bd = BitmapDescriptorFactory.fromBitmap(bitmap);
Then you have BitmapDescriptor
, which you can pass into MarkerOptions
.