I\'m trying to draw a circle on an image which placed as res/drawable/schoolboard.png
. the image fills the activity background. the following does not work:
First of all you need to create a new bitmap, because bitmap from BitmapFactory.decodeResource() method is immutable. You can do this with the following code:
Bitmap canvasBitmap = Bitmap.createBitmap([bitmap_width], [bitmap_height], Config.ARGB_8888);
Use this bitmap in Canvas constructor. Then draw your bitmap on canvas.
Canvas canvas = new Canvas(canvasBitmap);
canvas.drawBitmap(bitmap, 0, 0, bitmapPaint);
canvas.drawCircle(60, 50, 25, paint);
Also R.drawable.schoolboard is not a correct view id.
ImageView imageView = (ImageView)findViewById(R.drawable.schoolboard);