I tried to rotate an image with following code, but I found the generated image gets bigger and bigger:
Matrix matrix = new Matrix();
matrix.setRotate(10);
Bitmap newImage = Bitmap.createBitmap(image, 0, 0,
image.getWidth(), image.getHeight(), matrix, true);
You can see the pictures:
Original

Rotate 10 degree

Rotate 10 degree again

Rotate 10 degree again

The blue rectangles are full images.
You can see the images getting bigger and bigger(although the size of sofa is not changed), and the 4 corners of original image are not on the borders of new images later.
How to change the code to keep the corners on the border(just like the 2nd image)?
I forgot to say I’ve created a demo project on github. You can clone it, the main java code is here:
https://github.com/freewind/Android-RotateTest/blob/master/src/com/example/MyActivity.java
I tried your code and after some rotation it crashed with the OutOfMemory exception cause each time a new bitmap is created which is very resource intensive. You should never never! use createBitMap() in iteration. I made some modification to your image rotation code and now it’s running as expected.
Here is the code:
also set the scale type of the imageView to matrix
And if we want to get the rotated bitmap from ImageView, do this:
I hope this helps.