Android ACTION_GET_CONTENT does not update download dir files

余生长醉 提交于 2020-01-12 14:23:52

问题


I am facing an issue while choosing a file from Downloads directory using ACTION_GET_CONTENT.

If I delete any file in ES explorer or file manager in my local storage, those deleted files aren't removed in downloads dir while opening in my app.

Any changes in downloads dir dosen't get reflected in chooser.

To choose a file I am using the below library

https://github.com/iPaulPro/aFileChooser.

Here I attach my screenshot please have a look:


回答1:


You must have to call getContentResolver().delete(uri, null, null) while deleting the file, where uri is the URI of the file to delete. This will update Media Store, which holds URIs of all files. So, when ACTION_GET_CONTENT opens the downloads directory, the file you deleted won't appear here.



来源:https://stackoverflow.com/questions/37883092/android-action-get-content-does-not-update-download-dir-files

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