The method below works, but it unfortunately, this method involves creating a bitmap the size of the entire screen - not just the area that is drawn to. If I use this to dra
I encountered something similar, where canvas.getWidth() and canvas.getHeight() returns the width and height of the whole screen instead of the view itself.
Try to use the below instead:
Bitmap bitmap=Bitmap.createBitmap(getWidth(), getHeight(), Config.ARGB_8888);
For my case, getWidth() and getHeight() returns me the dimensions of my view. Good luck!