Skip to content

Commit

Permalink
Refresh MediaStore.Video.Media if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Nicholson committed Mar 17, 2013
1 parent 9cd322f commit cdc7d00
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions src/au/com/infiniterecursion/vidiom/activity/LibraryActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -422,11 +422,11 @@ public void setViewImage(ImageView v, String s) {
// generate one.

// XXX Check cache, and load from filepath, using code above.
/*
* Log .d( TAG, " We have id " + thumb_cursor
* .getLong(thumb_cursor
* .getColumnIndexOrThrow(MediaStore.Video.Media._ID)));
*/

Log .d( TAG, "In thumb_cursor , we have id " + thumb_cursor
.getLong(thumb_cursor
.getColumnIndexOrThrow(MediaStore.Video.Media._ID)));


Bitmap bm = MediaStore.Video.Thumbnails
.getThumbnail(
Expand All @@ -439,9 +439,29 @@ public void setViewImage(ImageView v, String s) {
}

} else {

Log.d(TAG, " Thumb_cursor is empty ");

// set default icon
v.setImageResource(R.drawable.icon);


// Perhaps the MediaStore has been reset. We need to re-enable it
// Send the info to the inbuilt Android Media Scanner

// Save the name and description of a video in a
// ContentValues map.
ContentValues values = new ContentValues(2);
values.put(MediaStore.Video.Media.MIME_TYPE, "video/mp4");
values.put(MediaStore.Video.Media.DATA, s);

Uri uri = getContentResolver()
.insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
values);

sendBroadcast(new Intent(
Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri));

}

}
Expand Down

0 comments on commit cdc7d00

Please sign in to comment.