Retrieving the contents of a specific directory on an SDCard

How can I get an array of all files in a specific directory on an SD card, i.e. / ringtone /?

+4
source share
3 answers

It is very simple. Just follow these steps:

File dir = new File(path); String[] files = dir.list(); 
+3
source
0
source

You look at a specific place, and obviously, if you are looking in the ringtone directory, then you need audio-type files. Here's how to do it.

I have created an example application for you that shows exactly how to complete this task.

Source code: search for files by type + media playback

0
source

Source: https://habr.com/ru/post/1315032/


All Articles