【发布时间】:2018-11-09 10:08:52
【问题描述】:
我正在尝试使用:
public int getCameraPhotoOrientation(Context context, Uri imageUri, String imagePath){
int rotate = 0;
try {
context.getContentResolver().notifyChange(imageUri, null);
File imageFile = new File(imagePath);
ExifInterface exif = new ExifInterface(imageFile.getAbsolutePath());
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_270:
Timber.d("270");
break;
case ExifInterface.ORIENTATION_ROTATE_180:
Timber.d("180");
break;
case ExifInterface.ORIENTATION_ROTATE_90:
Timber.d("90");
break;
}
} catch (Exception e) {
e.printStackTrace();
}
return rotate;
}
我正在传递 URL:
file:///storage/emulated/0/DCIM/Camera/IMG_20181109_144042.jpg
我收到了错误:
java.lang.SecurityException: Failed to find provider for user 0; expected to find a valid ContentProvider for this authority
【问题讨论】:
-
你是否在 manifest 中添加了读取权限?
-
什么是读取权限.. 因为我没有使用自定义内容提供程序
标签: android