从列表视图sd卡显示特定文件夹中的视频 [英] display videos from specific folder from sd card in listview

查看:178
本文介绍了从列表视图sd卡显示特定文件夹中的视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图来填充视频文件列表视图从SD卡上创建一个文件夹。我使用

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);

但它填充保存在SD卡的所有视频,但我想只有那些被保存在指定文件夹的视频。我也用

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); 

Uri uri = Uri.parse(filepath);
cursor = managedQuery(uri, mystring , null , null , null);

但它不工作。我曾尝试很多东西,从谷歌得到的帮助仍然没有succeded。
有没有什么办法让该文件夹的路径?或任何其他方式?

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?

推荐答案

您可以使用此code为获得特定文件夹的影片为:

you can use this code for get videos from specific folder as:

String selection=MediaStore.Video.Media.DATA +" like?";
        String[] selectionArgs=new String[]{"%FolderName%"};
        videocursor = managedQuery(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
                parameters, selection, selectionArgs, MediaStore.Video.Media.DATE_TAKEN + " DESC");

这篇关于从列表视图sd卡显示特定文件夹中的视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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