// scan sd card public void scanMusic(File file) { File[] listFiles = file.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { if (pathname.isDirectory()) { return true; } else { // Determine whether the path of the next file contains. mp3 if (pathname.getPath().endsWith(".mp3")) { return true; } } return false; } }); for(int i=0;i<listFiles.length;i++){ if(listFiles[i].isDirectory()){ }else{ fileList() } } }