There are some errors in your code: firstly, you cannot give a reference identifier for drawable in findViewById so I think you mean something like this
ImageView imageView = (ImageView)findViewById(R.id.schoolboard_image_view);
schoolboard_image_view is the id of the image in your xml layout (check your layout for the correct id)
BitmapFactory.Options myOptions = new BitmapFactory.Options(); myOptions.inDither = true; myOptions.inScaled = false; myOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;// important myOptions.inPurgeable = true; Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.schoolboard,myOptions); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setColor(Color.BLUE); Bitmap workingBitmap = Bitmap.createBitmap(bitmap); Bitmap mutableBitmap = workingBitmap.copy(Bitmap.Config.ARGB_8888, true); Canvas canvas = new Canvas(mutableBitmap); canvas.drawCircle(60, 50, 25, paint); ImageView imageView = (ImageView)findViewById(R.id.schoolboard_image_view); imageView.setAdjustViewBounds(true); imageView.setImageBitmap(mutableBitmap);
Please use the correct image id for:
ImageView imageView = (ImageView) findViewById ( R.id.schoolboard_image_view );
moh.sukhni
source share