【发布时间】:2014-09-10 07:36:57
【问题描述】:
我有 id 联系人,我怎样才能找到他的群组(朋友、家人、收藏夹...)?
我试试:
String where = String.format("%s = ?", ContactsContract.Groups._ID);
String[] whereParams = new String[]{id};
String[] selectColumns = {ContactsContract.Groups.TITLE};
Cursor c = cr.query(Data.CONTENT_URI, selectColumns, where, whereParams, null); //THIS_LINE
Log.d("Log", "cursor GROUP " + c.getString(0));
c.close();
但我在 THIS_LINE 中有例外:
E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-24188
Process: com.app.contactsmyclients, PID: 22499
java.lang.IllegalArgumentException: Invalid column title
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:167)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:463)
at android.content.ContentResolver.query(ContentResolver.java:476)
【问题讨论】:
-
看看这个post