我如何從特定文件夾獲取所有Mp3文件的列表?來自特定文件夾的Mp3文件列表 - Android
我的文件夾是
FILE_PATH = Environment.getExternalStorageDirectory().getPath() + "/my folder/"
這下面的代碼顯示所有文件夾中所有MP3 ..我想從我的文件夾只有
Cursor createCursor(String filter) {
ArrayList<String> args = new ArrayList<String>();
String selection;
if (mShowAll) {
selection = "(_DATA LIKE ?)";
args.add("%");
} else {
selection = "(";
for (String extension : CheapSoundFile.getSupportedExtensions()) {
args.add("%." + extension);
if (selection.length() > 1) {
selection += " OR ";
}
selection += "(_DATA LIKE ?)";
selection = selection + "AND (IS_MUSIC=1)";
}
selection += ")";
selection = "(" + selection + ") AND (_DATA NOT LIKE ?)";
args.add("%espeak-data/scratch%");
}
if (filter != null && filter.length() > 0) {
filter = "%" + filter + "%";
selection =
"(" + selection + " AND " +
"((TITLE LIKE ?) OR (ARTIST LIKE ?) OR (ALBUM LIKE ?)))";
args.add(filter);
args.add(filter);
args.add(filter);
}
任何一個?可以幫我? – Mullinsangebn 2014-09-05 11:58:55
檢查此:http://stackoverflow.com/questions/17210519/how-to-access-all-mp3-files-from-all-the-subfolders-in-the-sdcard – kedark 2014-09-05 17:50:08
是的,但我不知道如何與我的代碼... – Mullinsangebn 2014-09-06 10:14:07