Reputation: 473
I'm creating a view that will allow me to draw over a given bitmap.
As I create the canvas I set the bitmap as the base for it. It works perfectly on an emulator but, when I try to use it on my phone it behave strangely and rotate the bitmap by 90 degrees.
Here is how I create the canvas. I get the right backgroundPicture
from my previous activity.
mBitmap = backgroundPicture.copy(Bitmap.Config.ARGB_8888, true);
mBitmap = Bitmap.createScaledBitmap(mBitmap, width, height, true);
mCanvas = new Canvas(mBitmap);
ANd here are the screenshots
What it displays in my recycler view (displays normally)
What it displays on the canvas (90 degrees on the left)
Thank you for your help, I'm not used to work with canvases so I'm a bit lost :/
Upvotes: 2
Views: 93
Reputation: 473
After some digging it appears that the problem comes from my smartphone, a Samsung Galaxy A3. In some Samsung models the camera is rotated to gain place for the others components of the phone. Some Samsung handle the difference but if they don't you'll get an rotation of 0 and you'll have to handle the rotation problem model by model manually.
I hope this will help other people.
Cordially, Matthieu
Upvotes: 2