It looks like you need to draw with anti-aliasing enabled. In this line:
canvas.drawBitmap(icon_pin, new Matrix(), null);
You can specify a Paint
object to use for drawing. Above, you use null
. You can add these lines before your call to canvas.drawBitmap()
:
Paint myPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
myPaint.setFilterBitmap(true);
Then change your last line to:
canvas.drawBitmap(icon_pin, new Matrix(), myPaint);
This code creates a new Paint
object with anti-aliasing enabled, which will hopefully take out the jagged edges on your markers.
Note: You can also use Paint
to apply colors, alpha shading and other cool effects to your drawing. See the Android documentation here.