android - 如何显示android文件系统中所有文件夹的列表,特别是SD卡

标签 android android-listview

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

最佳答案

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

这将返回路径中的文件夹列表。 来自这里:https://stackoverflow.com/a/6997422/2065418

关于android - 如何显示android文件系统中所有文件夹的列表,特别是SD卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19786222/

相关文章:

android - 使用网络服务和 picasso 加载图像,如何添加采样大小?

Android 应用内购买 : This version of the application is not configured for billing through Google Play

java - Android:无法向应用程序添加新的应用内产品......?

android - 自定义警报中的 handler.postDelayed 导致我的应用程序崩溃

android - 取消选择 ListView 中的选定项目

android - 在 ListView 中突出显示并保持突出显示所选项目

安卓 : Move arrow's end point and start point on user's touch event

java - 使用 UniversalImageLoader 为 ListView 预加载一些图像

android - JSON Android ListView

Android Layout 效率,多 View 还是单 View 隐藏?