Need absolute file path of selected file using Intent.ACTION_OPEN_DOCUMENT in android pie

匆匆过客 提交于 2020-03-05 04:39:16

问题


I want to get pdf and convert it into base64. use this code to start picker

Intent  intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
            String [] mimeTypes = {"image/*", "application/pdf"};
            intent.setType("*/*");
            intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
            startActivityForResult(intent, 1);

I had used below solution : https://stackoverflow.com/a/41440869/6864437

but it is not working on android pie

getting below error: Request header queries do not support projections, selections or sorting

How to get the Full file path from URI


回答1:


Solution used : I use input stream (suggested by @blackaaps) to get data from file and create new file which I can use to get full path.



来源:https://stackoverflow.com/questions/58544580/need-absolute-file-path-of-selected-file-using-intent-action-open-document-in-an

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!