Android ACTION_GET_CONTENT不会更新下载目录文件 [英] Android ACTION_GET_CONTENT does not update download dir files

查看:124
本文介绍了Android ACTION_GET_CONTENT不会更新下载目录文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 ACTION_GET_CONTENT 下载目录中选择文件时,我遇到了问题.

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

如果我在本地存储中的ES资源管理器或文件管理器中删除了任何文件,则在打开我的应用程序时,不会在下载目录中删除这些删除的文件.

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:

推荐答案

删除文件时必须必须调用getContentResolver().delete(uri, null, null),其中uri是要删除的文件的URI.这将更新保存所有文件URI的媒体存储.因此,当 ACTION_GET_CONTENT 打开下载目录时,您删除的文件将不会显示在这里.

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.

这篇关于Android ACTION_GET_CONTENT不会更新下载目录文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆