在android中捕获图像光标返回空值
在应用程序中,我使用cursorloader获取捕获的图像文件路径,它总是返回在android中捕获图像光标返回空值,android,cursor,image-capture,Android,Cursor,Image Capture,在应用程序中,我使用cursorloader获取捕获的图像文件路径,它总是返回null: Uri file path = file:///storage/emulated/0/Pictures/BBI_Images/BBI_ORIG_20150313_112912.jpg public static int getRotation(Context context, Uri selectedImage, String filePath) { try{ String
null
:
Uri file path = file:///storage/emulated/0/Pictures/BBI_Images/BBI_ORIG_20150313_112912.jpg
public static int getRotation(Context context, Uri selectedImage, String filePath) {
try{
String[] projection = { MediaStore.Images.Media.DATE };
CursorLoader loader = new CursorLoader(context, selectedImage, projection, null, null, null);
Cursor cursor = loader.loadInBackground();//here i can get only null
cursor.moveToFirst();
int column_index_data = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
int rotation = 0;
String realPath = cursor.getString(column_index_data);
if (realPath != null) {
rotation = getRotationForImage(realPath);
}
return rotation;
}catch(Exception e){
e.printStackTrace();
}
return 0;
}
是否引发了任何错误?请看这里……游标加载程序不是自动创建的,您需要做更多的工作: