Android 如何从contentprovider获取联系人,其中联系人id最大为特定号码

Android 如何从contentprovider获取联系人,其中联系人id最大为特定号码,android,android-contentprovider,android-query,Android,Android Contentprovider,Android Query,我想获取id大于特定号码的所有联系人 我的代码是: String xml = "["; max_contact_id="1000"; final String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " ASC"; Cursor cur = content.query(ContactsContract.Contacts.CONTENT_URI, null , ContactsContract.C

我想获取id大于特定号码的所有联系人

我的代码是:

    String xml = "[";
    max_contact_id="1000";

    final String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " ASC";

    Cursor cur = content.query(ContactsContract.Contacts.CONTENT_URI, null , ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" > ?",
            new String[]{max_contact_id}, sortOrder);
但这行不通

使用 LoaderManager.LoaderCallbacks

实现LoaderManager.LoaderCallbacks
@凌驾
公共加载器onCreateLoader(int-id,@Nullable Bundle args){
返回新的游标装入器(getActivity(),
ContactsContract.CommonDataTypes.Phone.CONTENT\u URI、ProfileQuery.PROJECTION、,
//仅选择电子邮件地址
空,空,空);
}
@凌驾
public void onLoadFinished(加载器,光标){
cursor.moveToFirst();
而(!cursor.isAfterLast()){
String phoneNumber=cursor.getString(ProfileQuery.NUMBER);
String name=cursor.getString(ProfileQuery.name);
cursor.moveToNext();
}
}

尝试将此数字减少到10,并将一些投影改为null。很难获得1000个联系人的数量,也许你没有达到这个数量。
implements LoaderManager.LoaderCallbacks<Cursor> 



 @Override
    public Loader<Cursor> onCreateLoader(int id, @Nullable Bundle args) {
        return new CursorLoader(getActivity(),
                ContactsContract.CommonDataKinds.Phone.CONTENT_URI, ProfileQuery.PROJECTION,
                // Select only email addresses
                null, null, null);
    }

@Override
    public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
        cursor.moveToFirst();


        while (!cursor.isAfterLast()) {

            String phoneNumber = cursor.getString(ProfileQuery.NUMBER);
            String name = cursor.getString(ProfileQuery.NAME);
            cursor.moveToNext();
        }



    }