【发布时间】:2018-10-05 14:46:32
【问题描述】:
我使用此代码查找 mp3 文件:
`
// String extStore = System.getenv("EXTERNAL_STORAGE");
// File home = new File(extStore);
//String extStore = "/storage/extSdCarcd";
String extStore = "/storage/";
File home = new File(extStore);
if(home.listFiles(new FileExtensionFilter()).length>0){
for(File file : home.listFiles(new FileExtensionFilter())){
HashMap<String,String> song = new HashMap<String, String>();
song.put("title",file.getName().substring(0,(file.getName().length()-4)));
song.put("path",file.getPath());
songsList.add(song);
}
}
return songsList;
}`
如您所见,我尝试了很多方法来获取 .mp3 文件,但如果我的蓝牙文件夹或音乐文件夹中有 mp3 文件,它们将无济于事。它们仅用于 sdcard 中的音乐
【问题讨论】:
标签: android path mp3 filefilter