如何从 ListView 中的特定文件夹中获取带有缩略图和文本的视频,例如 youtube
我正在尝试在特定文件夹的列表视图中显示视频缩略图和文本。 我正在获取缩略图,但是当我向视频添加文本并使用 ContentValues 进行更新时, 我得到所有视频上的文字。我将视频保存在自定义文件夹“/sdcard/myfolder/”中。
这就是我保存捕获的视频的方式(自定义摄像机):
ContentResolver contentResolver = getContentResolver();
Uri base = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;// how to specify folder
Uri newUri = contentResolver.insert(base, values);
我从图库中获取所有视频,如何指定文件夹。
这就是我尝试向列表视图中的每个视频添加文本的方法:
ContentValues values = new ContentValues(1);
values.put(MediaStore.Video.Media.DESCRIPTION, edtext.getText().toString());
//values.put(MediaStore.Video.Media.DATA, videoFile.getAbsolutePath());
ContentResolver contentResolver = getContentResolver();
Uri base = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
contentResolver.update(base, values,null,null);
这向所有视频添加相同的文本......有任何帮助吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这段代码:
似乎正在尝试在数据库中插入和更新值...如果您想从数据库中获取值并将它们显示在 listView 中,我建议您查看此 教程
如果您确实只是想从文件夹中提取项目并将其显示在列表中,我建议使用自定义ListViewAdapter教程此处。在他使用 Twitter Api 的地方,您将用提到的目录的 IO 内容替换该代码......
This code:
appears to be trying to insert and update values in a database... If you want to take values from a database and display them in a listView I would recommend looking at this tutorial
If you are truly just wanting to pull items from a folder and display them in a list I would recommend using a Custom ListViewAdapter tutorial here. Where he is using Twitter Api you will be replacing that code with IO stuff for the directory mentioned...