如何从电话簿Android获取联系人时在CONTACT_LAST_UPDATED_TIMESTAMP上过滤联系人?

时间:2016-02-18 13:44:51

标签: android android-contentprovider android-contacts android-contentresolver android-syncadapter

在我的应用程序中,我想通过手机联系,我想在CONTACT_LAST_UPDATED_TIMESTAMP上过滤它,请帮助我怎么可能?

我的查询是:

 Cursor crr = cr.query(
                        ContactsContract.CommonDataKinds.Phone.CONTENT_URI,                       
 new String[] {ContactsContract.CommonDataKinds.Phone.CONTACT_ID
                                ContactsContract.CommonDataKinds.Phone.CONTACT_LAST_UPDATED_TIMESTAMP,
                                ContactsContract.CommonDataKinds.Phone.DATA_VERSION,                                
                        ContactsContract.CommonDataKinds.Phone.CONTACT_LAST_UPDATED_TIMESTAMP + " = ?",
                        new String[]{" > '1455531760472' "}, null);

但此查询返回0原始计数。请告诉我是否正确的过滤方式?

1 个答案:

答案 0 :(得分:3)

我提出了自己的问题答案:

Cursor crr = cr.query(
                        ContactsContract.CommonDataKinds.Phone.CONTENT_URI,                       
 new String[] {ContactsContract.CommonDataKinds.Phone.CONTACT_ID
                                ContactsContract.CommonDataKinds.Phone.CONTACT_LAST_UPDATED_TIMESTAMP,
                                ContactsContract.CommonDataKinds.Phone.DATA_VERSION,                                
                        ContactsContract.CommonDataKinds.Phone.CONTACT_LAST_UPDATED_TIMESTAMP + " > ?",
                        new String[]{"1455531760472"}, null);