My application ( started on Android 2.3.3 ) has also to support the Android Ice Cream OS 4.0.3. All works fine but the query from Content Resolver makes strange things with the round parenthesis when GROUP BY is used and the SQL complains about that giving a crash. The same is not seen with Android API level 10. That said, here my question: is it possible to use old version or the API ( 10 in my case ) also on the Ice Cream? Of course if there is a better solution to my problem it will be welcomed.
事先感谢。
法典(简化版)如下:
ContentResolver contentResolver = context.getContentResolver();
Uri uri = Uri.withAppendedPath( ContactsContract.Data.CONTENT_URI, "");
StringBuilder where = new StringBuilder();
allContactCursor = contentResolver.query( uri,
PROJECTION_CONTACT,
"1) GROUP BY ( "+ RawContacts.CONTACT_ID,
null,
ContactsContract.Contacts.DISPLAY_NAME + " COLLATE NOCASE");
The problem is that the Ice Cream Sandwich doesn t allow the GROUP BY injection while compiling the Sqlite query, this, instead, works on Gingerbread 2.3.3. Without GROUP BY the contacts are duplicated depending on the number of phone numbers a contact has.
成就