2012-06-10 15 views
2

我正在閱讀Android中Google帳戶的RawContacts。如何在閱讀RawContacts時排除GooglePlus聯繫人

final Cursor cursor = cr.query(
    ContactsContract.RawContacts.CONTENT_URI, null, 
    RawContacts.ACCOUNT_TYPE + " = ?", 
    new String[] { "com.google" }, "display_name"); 
Log.i(TAG, "Start RawContact table"); 
for (int i = 0; i < cursor.getColumnCount(); i++) { 
    Log.d(TAG, i + " : " + cursor.getColumnName(i) + " : " 
      + cursor.getString(i) + "\n"); 
} 
Log.i(TAG, "End RawContact table"); 

但是谷歌加上聯繫人也被納入混合。

06-10 15:05:11.139: D/Merger(20004): 13 : account_type : com.google 
06-10 15:05:11.139: D/Merger(20004): 14 : account_type_and_data_set : com.google/plus 

我該如何預防?

回答

1

答案很簡單。我只是沒有看到它。希望這可以幫助某人。

Cursor cursor = cr.query(
      ContactsContract.RawContacts.CONTENT_URI, null, 
      RawContacts.ACCOUNT_TYPE + " IS ? AND "+ RawContacts.DATA_SET+" IS NULL", 
      new String[] { "com.google", }, "display_name");