1
我使用Mediarecorder捕獲視頻,將其插入到媒體存儲中,然後在下一屏幕中更新該視頻的內容值。 但它改變列表中所有視頻的描述,我只想改變當前錄製的視頻。 下面是一些代碼:更新特定視頻的媒體庫內容
ContentValues values = new ContentValues(1);
//long current = System.currentTimeMillis();
//values.put(MediaStore.Video.Media.DATE_ADDED, (int) (current/1000));
//values.put(MediaStore.Video.Media.MIME_TYPE, "video/mp4");
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);
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, base));
我的列表視圖中使用此:
cursor = managedQuery(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
mediaColumns, null, null, null);
ArrayList<VideoViewInfo> videoRows = new ArrayList<VideoViewInfo>();
if (cursor.moveToFirst()) {
do {
VideoViewInfo newVVI = new VideoViewInfo();
int id = cursor.getInt(cursor
.getColumnIndex(MediaStore.Video.Media._ID));
Cursor thumbCursor = managedQuery(
MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI,
thumbColumns, MediaStore.Video.Thumbnails.VIDEO_ID
+ "=" + id, null, null);
if (thumbCursor.moveToFirst()) {
newVVI.thumbPath = thumbCursor.getString(thumbCursor
.getColumnIndex(MediaStore.Video.Thumbnails.DATA));
Log.v(QUEUE_LOG, "Thumb " + newVVI.thumbPath);
}
newVVI.filePath = cursor.getString(cursor
.getColumnIndexOrThrow(MediaStore.Video.Media.DATA));
newVVI.caption = cursor
.getString(cursor
.getColumnIndexOrThrow(MediaStore.Video.Media.DESCRIPTION));
我如何解決這個問題?如何使這是一個私人文件夾我的應用程序?
好的謝謝,即時在正確的軌道上。 – Codes12