简体   繁体   中英

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM