1

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.

Edit:

I got some Strange log in LogCat,

when i take a picture the LogCat show some message:

here

I never use video...

why video is started??

user1531240
  • 875
  • 1
  • 11
  • 20
  • don't focus on the reason why i have to scale the bitmap, it is a complicated story that i don't want to say it. Lets focus on why S3 can't show the image on ImageView, the mHight and mWidth are also -1 in S3 and xperia, but why xperia can work fine, even another device..., just S3 failed – user1531240 Sep 04 '12 at 06:30

1 Answers1

3

I searched around and it seems there might be two possible reasons:

1) S3 has memory problems. Check out this SO Question The S3 gives problems even when scaling images!

Solution- The solution is to make the bitmap conversion more memory-friendly as shown here and discussed in this SO question


2) Samsung phones set the EXIF orientation tag, rather than rotating individual pixels

Solution- Take a look at this SO question

Community
  • 1
  • 1
tipycalFlow
  • 7,594
  • 4
  • 34
  • 45
  • In my case, Samsung Galaxy Nexsus is work fine...just S3 can't show image, and i found some strange message in LogCat, did someone know why the video function is triggered when i want to take picture? – user1531240 Sep 04 '12 at 07:34