解决办法:

int degree = ImageUtil.readPictureDegree(imageUri.getPath());Bitmap bmpOk = ImageUtil.rotateToDegrees(bmp, degree);

/** * 图片旋转 * @param tmpBitmap * @param degrees * @return */public static Bitmap rotateToDegrees(Bitmap tmpBitmap, float degrees) {    Matrix matrix = new Matrix();    matrix.reset();    matrix.setRotate(degrees);    return tmpBitmap =            Bitmap.createBitmap(tmpBitmap, 0, 0, tmpBitmap.getWidth(), tmpBitmap.getHeight(), matrix,                    true);}/** * 读取照片exif信息中的旋转角度 * @param path 照片路径 * @return角度           */public static int readPictureDegree(String path) {    int degree = 0;    try {        ExifInterface exifInterface = new ExifInterface(path);        int orientation =                exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION,                        ExifInterface.ORIENTATION_NORMAL);        switch (orientation) {            case ExifInterface.ORIENTATION_ROTATE_90:                degree = 90;                break;            case ExifInterface.ORIENTATION_ROTATE_180:                degree = 180;                break;            case ExifInterface.ORIENTATION_ROTATE_270:                degree = 270;                break;        }    } catch (IOException e) {        e.printStackTrace();    }    return degree;}

bmpOK就是我们需要的没有旋转过的照片了。

更多相关文章

  1. 【转载】Android事件分发机制完全解析,带你从源码的角度彻底理解(
  2. android GridView选择照片的完整实现
  3. android从相册中选择报无法加载照片
  4. android webview使用html5 上传相册、拍照照片
  5. Android事件分发机制完全解析,带你从源码的角度彻底理解
  6. [置顶] 从源码角度分析Android View的绘制机制(一)
  7. 从性能角度选购Adroid智能手机,双核、大屏与游戏的取舍

随机推荐

  1. Qt开发Android范例详入门详解
  2. 跟Google学习Android开发-起始篇-构建你
  3. Android中使用ps命令查看进程PID
  4. 2013年Android将成最大智能型手机平台
  5. Android(安卓)在一个APP内打开另一个APP
  6. 我的android 第13天 -SQLiteOpenHelper对
  7. Linux 下使用命令行开发 Android(安卓)应
  8. Android中JNI的使用之一:Java原生JNI的使
  9. Android常用的数据加密方式代码详解
  10. 剖析Android中进程与线程调度之nice