由网友(死亡与爱)分享简介:只是一个简单的问题,怎么我得到一个指定的目录中的目录列表。Just a quick question, how to I get a list of directories inside a specified directory.例如,String path = Environment.getExternalS...
只是一个简单的问题,怎么我得到一个指定的目录中的目录列表。
Just a quick question, how to I get a list of directories inside a specified directory.
例如,
String path = Environment.getExternalStorageDirectory().toString()+"/myApp/";
现在我需要得到的目录是路径目录下的列表中。
now I'd need to get the list of directories that are inside the "path" directory.
谢谢!
推荐答案
这样的东西(加空检查,异常等。)
Something like that (add null checking, exceptions etc..)
File f = new File(path);
File[] files = f.listFiles();
for (File inFile : files) {
if (inFile.isDirectory()) {
// is directory
}
}
相关推荐
最新文章