I'm trying to show video thumbnail and text in a Listview from specific folder. I am getting the thumbnails,but when i add text to a video and update using ContentValues, I get the text on all videos. I saved the videos in a custom folder "/sdcard/myfolder/".
this is how i save the video captured(custom camera recorder):
ContentResolver contentResolver = getContentResolver();
Uri base = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;// how to specify folder
Uri newUri = contentResolver.insert(base, values);
I'm getting all videos from gallery, how to specify a folder.
This is how i try adding text to each video in Listview:
ContentValues values = new ContentValues(1);
values.put(MediaStore.Video.Media.DESCRIPTION, edtext.getText().toString());
//values.put(MediaStore.V开发者_运维问答ideo.Media.DATA, videoFile.getAbsolutePath());
ContentResolver contentResolver = getContentResolver();
Uri base = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
contentResolver.update(base, values,null,null);
This adds same text to all videos....any help?
This code:
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);
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...
精彩评论