本文介绍了如何排除GOOGLEPLUS接触而读RawContacts的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在读谷歌从账户的Andr​​oid这样RawContacts。

I'm reading RawContacts from Google accounts in Android like this.

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");

不过谷歌,加上接触也得到扔进组合。

However Google plus contacts also get thrown into the mix.

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

我如何prevent呢?

How can I prevent this?

推荐答案

答案很简单。我只是没有看到它。希望这可以帮助别人。

Answer is very simple. I just didn't see it. Hope this helps someone.

    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");

这篇关于如何排除GOOGLEPLUS接触而读RawContacts的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 08:52