1. fuzzy query method used for sqlite Database Query
Like
%: 0 or more characters
_: 1 Character
2. Remove the spaces in the contact's phone number:
"replace"(data1, ' ', '') LIKE '13_________'
3. query numbers in the mobile phone number format
public Loader<Cursor> onCreateLoader(int id, Bundle args) { String phone = "\"replace\"(" + ContactsContract.CommonDataKinds.Phone.NUMBER + ",' ','')"; String expression = phone + " LIKE ? or " + phone + " LIKE ? or (" + phone + " LIKE ? and " + phone + " NOT LIKE ?)"+ " or " + phone + " LIKE ? or " + phone + " LIKE ? or (" + phone + " LIKE ? and " + phone + " NOT LIKE ?)"+ " or " + phone + " LIKE ? or " + phone + " LIKE ? or (" + phone + " LIKE ? and " + phone + " NOT LIKE ?)"; String[] filter = new String[]{ "13_________", "18_________" , "15_________", "154________", "013_________", "018_________", "015_________", "0154________", "+8613_________", "+8618_________", "+8615_________", "+86154________"}; CursorLoader cursorLoader = new CursorLoader(InvitePeopleActivity.this, ContactsContract.CommonDataKinds.Phone.CONTENT_URI, new String[]{ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER}, expression, filter,ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME); return cursorLoader;}