根据此声明,我会在列MediaStore.Audio.Albums._ID = 16
:
String[] stringArray = {"16"};
final Cursor mCursor = getContentResolver().query(
MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, // Uri
new String[]{ // String[] projection (columns)
MediaStore.Audio.Albums.ALBUM_ART,
MediaStore.Audio.Albums.ARTIST,
MediaStore.Audio.Albums.ARTIST,
MediaStore.Audio.Albums.NUMBER_OF_SONGS,
MediaStore.Audio.Albums.ALBUM_KEY
},
MediaStore.Audio.Albums._ID + "=?", // String selection
stringArray, // String[] selectionArgs
null, // sortOrder
null // CancellationSignal
);
现在我怎样才能获得同一列有多个值的多行,例如MediaStore.Audio.Albums._ID = 16,25,24,30,...etc
?
这样的东西?
String[] stringArray = {"16","25","24","30","14","31","28","23","17","16","13"};
final Cursor mCursor = getContentResolver().query(
MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, // Uri
new String[]{ // String[] projection (columns)
MediaStore.Audio.Albums.ALBUM_ART,
MediaStore.Audio.Albums.ARTIST,
MediaStore.Audio.Albums.ARTIST,
MediaStore.Audio.Albums.NUMBER_OF_SONGS,
MediaStore.Audio.Albums.ALBUM_KEY
},
MediaStore.Audio.Albums._ID + "=?", // String selection
stringArray, // String[] selectionArgs
null, // sortOrder
null // CancellationSignal
);
答案 0 :(得分:0)
您的mSelectionClause MediaStore.Audio.Albums._ID + "=?",
不正确。
Documentation说你需要一个“?”对于每个被替换的论点。
答案 1 :(得分:0)