}
private void scanForMedia(File root, List<File> result) {
if(root.exists() && root.isDirectory()) {
// List all matching mp3 files...
File[] files = root.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.isFile() && pathname.getName().toLowerCase().endsWith(".mp3");
}
});
// Add them to the collection
result.addAll(Arrays.asList(files));
// List all nested directories...
File[] dirs = root.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.isDirectory();
}
});