Skip to content

Instantly share code, notes, and snippets.

@hu2di
Created April 10, 2017 02:32
Show Gist options
  • Save hu2di/2a614a60641f057bd8cf9eb366607fe4 to your computer and use it in GitHub Desktop.
Save hu2di/2a614a60641f057bd8cf9eb366607fe4 to your computer and use it in GitHub Desktop.
Android: List all Video on device
public static void printNameOfVideos(Context context) {
Uri uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
String[] projection = { MediaStore.Video.VideoColumns.DATA };
Cursor c = context.getContentResolver().query(uri, projection, null, null, null);
int vidsCount = 0;
if (c != null) {
vidsCount = c.getCount();
while (c.moveToNext()) {
Log.d("VIDEO", c.getString(0));
}
c.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment