-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMediaQuery.java
More file actions
38 lines (36 loc) · 1.36 KB
/
MediaQuery.java
File metadata and controls
38 lines (36 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
private void vidQuery(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);
if (c != null) {
while (c.moveToNext()) {
String path = c.getString(0);
Log.d("VIDEO", path);
}
c.close();
}
}
private void musQuery(Context context) {
Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
String[] projection = {MediaStore.Audio.AudioColumns.DATA};
Cursor c = context.getContentResolver().query(uri, projection, null, null, null);
if (c != null) {
while (c.moveToNext()) {
String path = c.getString(0);
Log.d("AUDIO", path);
}
c.close();
}
}
private void picQuery(Context context) {
Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
String[] projection = {MediaStore.Images.ImageColumns.DATA};
Cursor c = context.getContentResolver().query(uri, projection, null, null, null);
if (c != null) {
while (c.moveToNext()) {
String path = c.getString(0);
Log.d("IMAGE", path);
}
c.close();
}
}