Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show list of all folders in android file system specially SD card

In my application I want to display all folders on an SD card in a listview and need functionality such that if a user clicks on a folder it will show its sub-directories.

like image 630
Saurabh Avatar asked Nov 05 '13 10:11

Saurabh


1 Answers

File f = new File(path);
File[] files = f.listFiles();
for (File inFile : files) {
    if (inFile.isDirectory()) {
        // is directory
    }
}

This will return you the list of folders in your path. From here: https://stackoverflow.com/a/6997422/2065418

like image 157
Damien R. Avatar answered Oct 16 '22 18:10

Damien R.