这是我到目前为止的代码:
List<File> dir = new ArrayList<File>();
List<File> files = new ArrayList<File>();
File root = new File (Environment.getExternalStorageDirectory().getAbsolutePath());
scan(root);
for (File f : dir) {
scan(f);
}
public void scan (File path) {
for (File f : path.listFiles()) {
if (f.isFile()) {
files.add(f);
}
else {
dir.add(f);
}
}
}