Android - Sqlite search using LIKE and UPPER on International characters -
i trying run search on contacts database , value pass in matches display name in contacts want homecoming cursor number of contacts match.
currently works ok except international characters, here how code looks constraint beingness charsequence taken edittext:
string[] projection = new string[] { contactscontract.contacts._id, contactscontract.contacts.display_name, contactscontract.contacts.has_phone_number, }; string sortorder = contactscontract.contacts.display_name + " collate localized asc"; public cursor runquery(charsequence constraint) { string selection = "upper(" + contactscontract.contacts.display_name + ")" + " upper('%" + constraint+ "%') " + "and " + contactscontract.contacts.display_name + " not null" + " , " + contactscontract.contacts.in_visible_group + " = '1'"; cursor cur = cr.query(contactscontract.contacts.content_uri, projection, selection, null, sortorder); homecoming cur; } as said works fine want search case insensitive user doesn't have type exact name, normal english language name works fine 1 time international characters introduced search becomes case sensitive.
i have done research suggests sqlite requires icu add together on create work missing android. or utilize collate when inserting database. since read contacts content provider not alternative me.
does know of way search in code above work international characters while beingness case insensitive?
android sqlite android-contacts android-cursor
No comments:
Post a Comment