需要在Android Pie中使用Intent.ACTION_OPEN_DOCUMENT选定文件的绝对文件路径 [英] Need absolute file path of selected file using Intent.ACTION_OPEN_DOCUMENT in android pie
本文介绍了需要在Android Pie中使用Intent.ACTION_OPEN_DOCUMENT选定文件的绝对文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获取pdf并将其转换为base64. 使用此代码启动选择器
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);
我使用以下解决方案: https://stackoverflow.com/a/41440869/6864437
I had used below solution : https://stackoverflow.com/a/41440869/6864437
但是它不能在android pie上运行
but it is not working on android pie
得到以下错误: 请求标头查询不支持投影,选择或排序
getting below error: Request header queries do not support projections, selections or sorting
推荐答案
使用的解决方案:我使用输入流(由@blackaaps建议)从文件中获取数据并创建新文件,以用于获取完整路径.
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.
这篇关于需要在Android Pie中使用Intent.ACTION_OPEN_DOCUMENT选定文件的绝对文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文