【发布时间】:2014-09-05 09:33:05
【问题描述】:
我如何从特定文件夹中获取所有 Mp3 文件的列表?
我的文件夹是
FILE_PATH = Environment.getExternalStorageDirectory().getPath() + "/my folder/"
以下代码显示所有文件夹中的所有 mp3 .. 我只想从我的文件夹中播种 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);
}
【问题讨论】:
-
有人吗?可以帮我吗?
-
是的,它可以工作,但我不知道如何处理我的代码...