Slightly complicated phrasing, so apologies, but here is the situation.
On my phone, I go to the dial screen and a keypad pops up. I type: "728". Near the top of the list are names like Patrick lastNameson and Paul otherLastNameson. Clearly, the 728 is being converted using the standard alphabet on a phone matching the letters (IE 7 is PQRS, 2 is ABC, 8 is TUV)
My question is, how do I go about querying the name to include a converted number and find the respective contact? Essentially, how does this phone screen on my device search for "Paul" or "Pat" when all I give it is 728?
The code I am using for my query is:
private void myMethod(String query){
if(query != null){
phoneWhere = ContactsContract.Data.MIMETYPE +
" = ? AND " +
"(" +
ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME +
" LIKE ? COLLATE NOCASE " +
"OR " +
ContactsContract.CommonDataKinds.Phone.NUMBER +
" LIKE ?" +
")";
phoneWhereParams = new String[]{
ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE, query, query};
} else {
phoneWhere = ContactsContract.Data.MIMETYPE + " = ?";
phoneWhereParams = new String[]{
ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE};
}
Cursor pCur = cr.query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
MY_PROJECTION_DEFINED_ELSEWHERE,
phoneWhere,
phoneWhereParams,
SORT_BY_DISPLAY_NAME_STRING_DEFINED_ELSEWHERE);
}
This works perfectly fine and I can use it to query the contact list. But, I want to add in this new feature that reverse engineers how the main dial screen of my device works.
Does anyone have any idea how this code would look? Or can anyone direct me to a sample of what I should be looking for?