Imagem Android selecionada da galeria Orientação é sempre 0: Exif TAG

Quando eu escolho uma imagem da galeria para configurá-lo no meu imageview no aplicativo android, em seguida, vejo quevem invertido em 180 ou 270 ou 90 graus.
Então, para verificar / resolver isso eu useiEXIF orientações, mas sempre me dá "0".

Eu não sou capaz de entender qual é o problema.

código:

Uri selectedImageUri = data.getData();

                    absolutePath = selectedImageUri.getPath();

                    exifMedia = new ExifInterface(absolutePath);
                    String exifOrint = exifMedia.getAttribute(ExifInterface.TAG_ORIENTATION);

                    exifOrientation = Integer.parseInt(exifOrint);

                    System.out.println("Orientation Tag is:"+exifOrientation);

                    /** Convert URI into byte */
                    ContentResolver cr = getBaseContext()
                    .getContentResolver();
                    InputStream inputStream = cr
                    .openInputStream(selectedImageUri);
                    Bitmap bitmap = BitmapFactory.decodeStream(inputStream);

                    rotatedBMP = getResizedBitmapImage(
                            bitmap, 100, 100,exifOrientation);

                    ByteArrayOutputStream stream = new ByteArrayOutputStream();
                    rotatedBMP.compress(Bitmap.CompressFormat.PNG, 100,
                            stream);
                    byteArray = stream.toByteArray();
                    mimProfileImageBrowse.setImageBitmap(rotatedBMP);

método:

public  Bitmap getResizedBitmapImage(Bitmap bm, int newHeight, int newWidth, int exifOrientation) {
        int width = bm.getWidth();
        int height = bm.getHeight();
        float scaleWidth = ((float) newWidth) / width;
        float scaleHeight = ((float) newHeight) / height;
        /**
         *  create a matrix for the manipulation
         */

        Matrix matrix = new Matrix();
        /**
         *  resize the bit map
         */


        /*

         1 = Horizontal (normal) 
2 = Mirror horizontal 
3 = Rotate 180 
4 = Mirror vertical 
5 = Mirror horizontal and rotate 270 CW 
6 = Rotate 90 CW 
7 = Mirror horizontal and rotate 90 CW 
8 = Rotate 270 CW

         */


        switch (exifOrientation) {
        case ExifInterface.ORIENTATION_ROTATE_270:

            rotate = 270;

            break;


        case ExifInterface.ORIENTATION_ROTATE_180:

            rotate = 180;


            break;

        case ExifInterface.ORIENTATION_ROTATE_90:

            rotate = 90;

            break;

        case ExifInterface.ORIENTATION_TRANSPOSE:

            rotate = 45;

            break;

        default:
            break;
        }


        matrix.postScale(scaleWidth, scaleHeight);
        matrix.postRotate(rotate);

        /**
         * recreate the new Bitmap
         */
        Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, false);
        resizedBitmap = Bitmap.createScaledBitmap(bm, 65, 65, true);

        return resizedBitmap;

    }

Por favor ajude. Além dissomatrix.postROTATE não está girando os bitmaps. Eu não sei porque.

obrigado

questionAnswers(8)

yourAnswerToTheQuestion