Bitmap issue in Samsung Galaxy S3
- by user1531240
I wrote a method to change Bitmap from camera shot :
public Bitmap bitmapChange(Bitmap bm) {
/* get original image size */
int w = bm.getWidth();
int h = bm.getHeight();
/* check the image's orientation */
float scale = w / h;
if(scale < 1) {
/* if the orientation is portrait then scaled and show on the screen*/
float scaleWidth = (float) 90 / (float) w;
float scaleHeight = (float) 130 / (float) h;
Matrix mtx = new Matrix();
mtx.postScale(scaleWidth, scaleHeight);
Bitmap rotatedBMP = Bitmap.createBitmap(bm, 0, 0, w, h, mtx, true);
return rotatedBMP;
} else {
/* if the orientation is landscape then rotate 90 */
float scaleWidth = (float) 130 / (float) w;
float scaleHeight = (float) 90 / (float) h;
Matrix mtx = new Matrix();
mtx.postScale(scaleWidth, scaleHeight);
mtx.postRotate(90);
Bitmap rotatedBMP = Bitmap.createBitmap(bm, 0, 0, w, h, mtx, true);
return rotatedBMP;
}
}
It works fine in another Android device, even Galaxy Nexus but in Samsung Galaxy S3, the scaled image doesn't show on screen.
I tried to mark the bitmapChange method , let it show the original size Bitmap on screen but S3 also show nothing on screen.
The information of variables in eclipse is here.
The information of sony xperia is here.
xperia and other device is working fine.