Create a bitmap, then draw it on the canvas, and then add that bitmap to the image or button or whatever you want.
Create a bitmap:
Bitmap bmp = Bitmap.createBitmap(width, height, config);
Draw a raster image canvas
Canvas c = new Canvas(bmp); c.drawCircle(cx, cy, radius, paint)
to view images
img.setBackgroundDrawable(new BitmapDrawable(bmp));
Hazem Farahat
source share