通过多个LOOKUP_KEY查询联系人
以下代码查询单个 LOOKUP_KEY 效果很好。
private final String lookup1 = "0r1-2E3C384E4846";
private final String lookup2 = "0r2-442C4E523A2C3E2C443450";
private final String lookup3 = "0r3-402C423442";
/////////
Uri lookUpUri = Contacts.getLookupUri(23, lookup1);
Uri res = ContactsContract.Contacts.lookupContact(getContentResolver(), lookUpUri);
Cursor contactCursor = getContentResolver().query(res, null, null, null, null);
contactCursor.moveToFirst();
Log.i("APP", "length: " + contactCursor.getString(contactCursor.getColumnIndex(Contacts.DISPLAY_NAME)) );
但是,正如代码可能建议的那样,我需要查询“x”个联系人。有没有一种方法可以一次查询所有这些,而不必循环它们?循环的效率非常低,所以我真的想避免它。
感谢一吨帮!
The following code queries great for a single LOOKUP_KEY.
private final String lookup1 = "0r1-2E3C384E4846";
private final String lookup2 = "0r2-442C4E523A2C3E2C443450";
private final String lookup3 = "0r3-402C423442";
/////////
Uri lookUpUri = Contacts.getLookupUri(23, lookup1);
Uri res = ContactsContract.Contacts.lookupContact(getContentResolver(), lookUpUri);
Cursor contactCursor = getContentResolver().query(res, null, null, null, null);
contactCursor.moveToFirst();
Log.i("APP", "length: " + contactCursor.getString(contactCursor.getColumnIndex(Contacts.DISPLAY_NAME)) );
However, as the code might suggest I need to query for "x" number of contacts. Is there a way to query for all of these at once without having to loop over them? Looping will be horribly inefficient so I really want to avoid it.
Thanks a ton gang!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论