显示联系人的排序内容解析器秩序ContactsContract.Contacts [英] Display the Contacts in sorting order ContactsContract.Contacts of Content Resolver

查看:201
本文介绍了显示联系人的排序内容解析器秩序ContactsContract.Contacts的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目的是要显示在联系人的排序顺序使用内容解析 android系统。

My intention is to display the contacts in sorting order using content resolver in android.

对于我写:

Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,
                            ContactsContract.CommonDataKinds.Phone.CONTACT_ID+ " = ?", new String[] { id }, null);

它需要在查询方法的最后一个参数不应该是由名称排序元素空。其中code部分我必须更换空参数,实现按名称排序?或者,请帮我查询在这种情况下...

It needs that the last parameter in query method should not be null for sorting the elements by Name. Which part of code I have to replace the null parameter to achieve sorting by name ? Or please help me querying in such a case...

在此先感谢

推荐答案

要根据名称使用排序结果 Phone.DISPLAY_NAME 常量 ASC 作为最后一个参数查询方法。做到这一点的:

To sort result according to name use Phone.DISPLAY_NAME constant with ASC as last parameter to query method. do it as:

  Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, 
                   null, 
                   ContactsContract.CommonDataKinds.Phone.CONTACT_ID+ " = ?",
                   new String[] { id },
                   ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME+" ASC");

这篇关于显示联系人的排序内容解析器秩序ContactsContract.Contacts的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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