有多少联系人列表中的联系人 [英] how many contacts in contact list

查看:146
本文介绍了有多少联系人列表中的联系人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何知道有多少接触有在联系人列表中?我的联系电话,但一个人可以有一个以上的接触,我要考虑到这一点在寻找联系人列表中的联系人总数。

How can I tell how many contacts there are in the contact list? I got the contact number, but one person can have more than one contact and I want to account for this in finding the total number of contacts in the contact list.

推荐答案

要找到所有的联系人的电话号码的计数

To find the count of phone numbers of all the contacts

Cursor cursor =  managedQuery(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);

int count = cursor.getCount();

要查找特定RawContactID的所有电话号码的个数(传值rawContactId接触式ID)。

To find the count of all the phone numbers of a particular RawContactID (pass the contact id value in rawContactId).

Cursor cursor =  managedQuery(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.RAW_CONTACT_ID + " = " + rawContactId, null, null);

    int count = cursor.getCount();

在ContactsListActivity显示的联系人的数量由可以通过下面的查询确定。

The number of contacts displayed in the ContactsListActivity consists can be determined by following query.

Cursor cursor =  managedQuery(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);

诠释计数= cursor.getCount();

int count = cursor.getCount();

但是,如果一个人那么只有一个实例被作为ContactsContract.Contacts结合了所有这些接触上述查询得到的多个账户下输入了。

However if a person has been entered under multiple accounts then only a single instance is obtained by the above query as ContactsContract.Contacts combines all such contacts.

Cursor cursor =  managedQuery(RawContacts.CONTENT_URI, null, null, null, null);

诠释计数= cursor.getCount();

int count = cursor.getCount();

ContactsContract.Contacts和RawContacts之间的关系,可以发现在 <一href="http://developer.android.com/resources/articles/contacts.html">http://developer.android.com/resources/articles/contacts.html

The relation between ContactsContract.Contacts and RawContacts can be found out at http://developer.android.com/resources/articles/contacts.html

希望这可以解决您的疑问!

Hope this resolves your doubt!

这篇关于有多少联系人列表中的联系人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆