"1) GROUP BY 1, (2" Не поддерживается в версии 10 для Android. Работает нормально на устройстве ниже версии 10 для Android.
private void fetchFolders() {
String str = "bucket_display_name";
String str2 = "_data";
Cursor query = getContext().getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, new String[]{"bucket_id", "bucket_display_name", "datetaken", "_data"}, "1) GROUP BY 1,(2", null, "MAX(datetaken) DESC");
if (query.moveToFirst()) {
int columnIndexOrThrow = query.getColumnIndexOrThrow(str);
int columnIndexOrThrow2 = query.getColumnIndexOrThrow(str2);
do {
String string = query.getString(columnIndexOrThrow);
String string2 = query.getString(columnIndexOrThrow2);
ModelClassForVideo modelClassForVideo = new ModelClassForVideo();
modelClassForVideo.setBoolean_selected(false);
modelClassForVideo.setSongPath(string2);
modelClassForVideo.setSongAlbum(string);
FolderArrayList.add(modelClassForVideo);
} while (query.moveToNext());
}
}
Ошибка:
android.database.sqlite.SQLiteException: near "GROUP": syntax error (code 1 SQLITE_ERROR): , while compiling: SELECT bucket_id, bucket_display_name, datetaken, _data FROM video WHERE ((is_pending=0) AND (is_trashed=0) AND (volume_name IN ( 'external_primary' , '0d07-4012' ))) AND ((1) GROUP BY 1,(2)) ORDER BY MAX(datetaken) DESC