无法使用ACTION\u OPEN\u DOCUMENT intent android从google drive获取选定的图像路径

无法使用ACTION\u OPEN\u DOCUMENT intent android从google drive获取选定的图像路径,android,Android,我正在使用以下代码从库中选择图片 if (Build.VERSION.SDK_INT <= 19) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION

我正在使用以下代码从库中选择图片

if (Build.VERSION.SDK_INT <= 19) {
                                    Intent intent = new Intent();
                                    intent.setType("image/*");
                                    intent.setAction(Intent.ACTION_PICK);
                                    startActivityForResult(Intent
                                            .createChooser(intent,
                                                    "Gallery"), 1);

                                } else {

                                    Intent intent = new Intent(
                                            Intent.ACTION_OPEN_DOCUMENT);
                                    intent.addCategory(Intent.CATEGORY_OPENABLE);
                                    intent.setType("image/*");
                                    startActivityForResult(intent,
                                            GALLERY_KITKAT_INTENT_CALLED);
                                }
当我从Images、Recently或Downloads文件夹中选择image时,这段代码非常有效。但当我尝试从google drive文件夹中选择image时,picturePath变量为空

下面是显示已打开的意图操作\u打开\u文档的屏幕截图


我知道这是很久以前的事了。。但你有没有找到解决办法?
if (requestCode == 1 && resultCode == RESULT_OK && null != data) {          
        Uri selectedImage = data.getData();
        String[] filePathColumn = { MediaStore.Images.Media.DATA };

        Cursor cursor = getContentResolver().query(selectedImage,
                filePathColumn, null, null, null);
        cursor.moveToFirst();

        int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
        picturePath = cursor.getString(columnIndex);
        cursor.close();         
    } else if (requestCode == GALLERY_KITKAT_INTENT_CALLED && data != null) {           
        Uri originalUri = data.getData();

        final int takeFlags = data.getFlags()
                & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);

        getContentResolver().takePersistableUriPermission(originalUri,
                takeFlags);

        String wholeID = DocumentsContract.getDocumentId(originalUri);
        String id = wholeID.split(":")[1];

        String[] column = { MediaStore.Images.Media.DATA };

        String sel = MediaStore.Images.Media._ID + "=?";

        Cursor cursor1 = getContentResolver().query(
                MediaStore.Images.Media.EXTERNAL_CONTENT_URI, column, sel,
                new String[] { id }, null);

        int columnIndex1 = cursor1.getColumnIndex(column[0]);

        if (cursor1.moveToFirst()) {
            picturePath = cursor1.getString(columnIndex1);
        }
        cursor1.close();            
    }