Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在android中捕获图像光标返回空值_Android_Cursor_Image Capture - Fatal编程技术网

在android中捕获图像光标返回空值

在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

在应用程序中,我使用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[] 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;
    }

是否引发了任何错误?请看这里……游标加载程序不是自动创建的,您需要做更多的工作: