I have a cursor that retrieves all the contacts in the application that have a street address. Then this cursor is passed to the adapter. So far, so good. In addition, I also get a bunch of inexpensive contacts (mostly from Skype) that only have state / country information. Is there an easy way to change the URIs to skip them?
public Cursor getDirectoryList (CharSequence constraint) { String[] selectionArguments = { "%"+constraint.toString()+"%" }; String selection = ContactsContract.CommonDataKinds.StructuredPostal.DISPLAY_NAME + " like ?"; Uri uri = ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_URI; String sortOrder = ContactsContract.CommonDataKinds.StructuredPostal.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; Cursor cr = getContentResolver().query(uri, null, selection, selectionArguments, sortOrder); return cr; }
android android-contentresolver simplecursoradapter street-address
Pyro979
source share