简体   繁体   中英

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

在我的应用程序中,我想在列表视图中显示SD卡上的所有文件夹,并且需要这样的功能:如果用户单击文件夹,它将显示其子目录。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM