在列表视图中显示 SD 卡中特定文件夹中的视频
我正在尝试使用 SD 卡上创建的文件夹中的视频文件填充列表视图。我正在使用
managedQuery(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,mystring, null, null, null);
但它填充了保存在 SD 卡中的所有视频,但我只想要那些保存在特定文件夹中的视频。我也用过
Uri uri = Uri.fromFile(filepath);
cursor = managedQuery(uri, mystring , null , null , null);
,
Uri uri = Uri.parse(filepath);
cursor = managedQuery(uri, mystring , null , null , null);
但是不起作用。我已经尝试了很多并得到了谷歌的帮助仍然没有成功。 有什么办法可以给出该文件夹的路径吗?或者任何其他方式?
i am trying to populate listview with video files from a folder created on sd card. I am using
managedQuery(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,mystring, null, null, null);
But it populates all videos saved in sdcard, but i want only those videos which are saved in specific folder. I have also used
Uri uri = Uri.fromFile(filepath);
cursor = managedQuery(uri, mystring , null , null , null);
and
Uri uri = Uri.parse(filepath);
cursor = managedQuery(uri, mystring , null , null , null);
But it doesn't work. I have tried lot and got help from google still not succeded.
Is there any way to give path of that folder? or any other way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用此代码从特定文件夹获取视频,如下所示:
you can use this code for get videos from specific folder as:
您可以像这样从特定位置获取文件
You can get a files form a specific location like this
嘿 ManagedQuery 搜索整个 SD 卡而不是特定文件夹。
上面的方法对于显示文件名是正确的,但是如果您要显示缩略图,则创建缩略图并将其存储在 Hashmap 中并将其填充到图库适配器列表中..............
hey managedquery search the whole sdcard not the specific folder .
the above method is true of display the name of file but if you to display thumbnail create thumbmail and store in in Hashmap and populate it to the list of gallery adapter..........