SDカードに保存する前に、カメラの意図を使用して画像を回転させることに関する解決策を得るために、かなり長い時間を探しています。縦向きで写真をキャプチャし、SD カードのファイル パスに移動して横向きに表示しようとしています。これを解決する方法はありますか?以下の限り、私のコード: -
 Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
    startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);   
    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == Activity.RESULT_OK) {
        if (requestCode == REQUEST_CAMERA) {
    Cursor cursor = getContentResolver().query(Media.EXTERNAL_CONTENT_URI, new String[]{Media.DATA, Media.DATE_ADDED, MediaStore.Images.ImageColumns.ORIENTATION}, Media.DATE_ADDED, null, "date_added ASC");
                if(cursor != null && cursor.moveToFirst())
                {
                    do {
                        uri = Uri.parse(cursor.getString(cursor.getColumnIndex(Media.DATA)));
                    photoPath = uri.toString();
Matrix matrix = new Matrix();
        ExifInterface exifReader = null;
        try {
            exifReader = new ExifInterface(photoPath);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }// Location of your image
        int orientation = exifReader.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
        if (orientation ==ExifInterface.ORIENTATION_NORMAL) {
        // Do nothing. The original image is fine.
        } else if (orientation == ExifInterface.ORIENTATION_ROTATE_90) {
               matrix.postRotate(90);
        } else if (orientation == ExifInterface.ORIENTATION_ROTATE_180) {
               matrix.postRotate(180);
        } else if (orientation == ExifInterface.ORIENTATION_ROTATE_270) {
               matrix.postRotate(270);
        }
                }while(cursor.moveToNext());
                cursor.close();
            }       
}