I started building my app for api 13, because I thougth it could be efficient enough for the most users.
But i changed it to api 10.
Then the following code stopped working `
String empName=data.getStringExtra("name");
String hourPay=data.getStringExtra("hourPay");
String key="";
String id="";
Uri lookupUri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_FILTER_URI, empName);
Cursor idCursor = getContentResolver().query(lookupUri, null, null, null, null);
idCursor.moveToFirst();
id = idCursor.getString(idCursor.getColumnIndex(ContactsContract.Contacts._ID));
key = idCursor.getString(idCursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));`
The problem is that it works only with contact names written in English or the ones that have just name (not surname)
For example :
It works for the following contacts :
Express Service,
George,
Maria Mpakou,
Σοφια,
With no distinction between languages
But when a contact is written in my language (greek) and has space (e.g Αιμιλιος Δημιος) it returns the underneath cursor with index out of bounds.
When i first tried at api 13 worked like a charm.
By the way my Android.Manifest has utf-8 encoding if that has something to do with it
Please any recomendation will bw helpfull.
Thanks
After a lot of search i finally did it with a different way…like asking a Sql query to all contacts
Here is the code:
That worked like a charm!