例外
04-12 16:05:16.170: E/AndroidRuntime(5027): FATAL EXCEPTION: main
04-12 16:05:16.170: E/AndroidRuntime(5027): android.database.sqlite.SQLiteException: unrecognized token: "0_id": , while compiling: SELECT _id, display_name, photo_id, contacts_status_updates.status_icon AS contact_status_icon, contacts_status_updates.status AS contact_status, agg_presence.mode AS contact_presence, photo_uri FROM view_contacts LEFT OUTER JOIN agg_presence ON (_id = agg_presence.presence_contact_id) LEFT OUTER JOIN status_updates contacts_status_updates ON (status_update_id=contacts_status_updates.status_update_data_id) WHERE (view_contacts.[single_is_restricted] = 0_id IN (SELECT contact_id FROM raw_contacts WHERE raw_contacts._id IN (SELECT data.raw_contact_id FROM data JOIN mimetypes ON (data.mimetype_id = mimetypes._id) WHERE mimetype_id=? AND data1=(SELECT groups._id FROM groups WHERE title=?)))) ORDER BY display_name ASC
04-12 16:05:16.170: E/AndroidRuntime(5027): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:179)
04-12 16:05:16.170: E/AndroidRuntime(5027): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
04-12 16:05:16.170: E/AndroidRuntime(5027): at android.content.ContentProviderProxy.query(ContentProviderNative.java:358)
04-12 16:05:16.170: E/AndroidRuntime(5027): at android.content.ContentResolver.query(ContentResolver.java:321)
04-12 16:05:16.170: E/AndroidRuntime(5027): at com.coperator.utils.contacts.ContactsUtils5.getContactsByGroup(ContactsUtils5.java:506)
04-12 16:05:16.170: E/AndroidRuntime(5027): at com.coperator.utils.contacts.ContactsUtils5.getCSipPhonesByGroup(ContactsUtils5.java:521)
04-12 16:05:16.170: E/AndroidRuntime(5027): at com.coperator.service.PresenceManager.getBuddiesForAccount(PresenceManager.java:61)
04-12 16:05:16.170: E/AndroidRuntime(5027): at com.coperator.service.PresenceManager.addBuddiesForAccount(PresenceManager.java:74)
04-12 16:05:16.170: E/AndroidRuntime(5027): at com.coperator.service.PresenceManager.updateRegistrations(PresenceManager.java:188)
04-12 16:05:16.170: E/AndroidRuntime(5027): at com.coperator.service.PresenceManager.access$0(PresenceManager.java:138)
04-12 16:05:16.170: E/AndroidRuntime(5027): at com.coperator.service.PresenceManager$AccountStatusContentObserver.onChange(PresenceManager.java:202)
04-12 16:05:16.170: E/AndroidRuntime(5027): at android.database.ContentObserver$NotificationRunnable.run(ContentObserver.java:43)
04-12 16:05:16.170: E/AndroidRuntime(5027): at android.os.Handler.handleCallback(Handler.java:605)
04-12 16:05:16.170: E/AndroidRuntime(5027): at android.os.Handler.dispatchMessage(Handler.java:92)
04-12 16:05:16.170: E/AndroidRuntime(5027): at android.os.Looper.loop(Looper.java:137)
04-12 16:05:16.170: E/AndroidRuntime(5027): at android.app.ActivityThread.main(ActivityThread.java:4464)
04-12 16:05:16.170: E/AndroidRuntime(5027): at java.lang.reflect.Method.invokeNative(Native Method)
04-12 16:05:16.170: E/AndroidRuntime(5027): at java.lang.reflect.Method.invoke(Method.java:511)
04-12 16:05:16.170: E/AndroidRuntime(5027): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:822)
04-12 16:05:16.170: E/AndroidRuntime(5027): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:589)
04-12 16:05:16.170: E/AndroidRuntime(5027): at dalvik.system.NativeStart.main(Native Method)
代码
@Override
public Cursor getContactsByGroup(Context ctxt, String groupName) {
if (TextUtils.isEmpty(groupName)) {
return null;
}
String[] projection;
if (Compatibility.isCompatible(11)) {
projection = new String[] {
Contacts._ID,
Contacts.DISPLAY_NAME,
Contacts.PHOTO_ID,
Contacts.CONTACT_STATUS_ICON,
Contacts.CONTACT_STATUS,
Contacts.CONTACT_PRESENCE,
Contacts.PHOTO_URI
};
} else {
projection = new String[] {
Contacts._ID,
Contacts.DISPLAY_NAME,
Contacts.PHOTO_ID,
Contacts.CONTACT_STATUS,
Contacts.CONTACT_PRESENCE
};
}
Uri searchUri = Uri.withAppendedPath(Contacts.CONTENT_GROUP_URI, Uri.encode(groupName));
return ctxt.getContentResolver().query(searchUri, projection, null, null,
Contacts.DISPLAY_NAME + " ASC");
}