Created
April 10, 2017 02:32
-
-
Save hu2di/2a614a60641f057bd8cf9eb366607fe4 to your computer and use it in GitHub Desktop.
Android: List all Video on device
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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