Getting file from sdcard with Uri

淺唱寂寞╮ 提交于 2019-12-06 01:49:25

Your Uri contains the file: scheme, which you need to remove. Using Uri.parse, you figure the Uri contained in your String, using uri.getPath(), you extract the file path from the uri :

Uri uri = Uri.parse(fileURI);
File pdf = new File(uri.getPath());

Your code is correct, maybe the file is not present or the path is wrong. See the stack trace. The first line itself tells the whole problem. Try accessing some other file and parse the filePath first using URI

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