How do I make a case insensitive query with ContentResolver in Android?

前端 未结 3 817
半阙折子戏
半阙折子戏 2021-02-08 04:45

My goal is to get all rows from native db with a specific email address on Android Gingerbread and above.

This query gets only the rows where the case also matches.

3条回答
  •  逝去的感伤
    2021-02-08 05:33

    Also try

    Cursor cursor = context.getContentResolver().query(ContactsContract.CommonDataKinds.Email.CONTENT_URI,
                new String[] {Contacts._ID}, ContactsContract.CommonDataKinds.Email.ADDRESS + "=? COLLATE NOCASE",
                new String[] {email}, null);
    

    Note that added COLLATE NOCASE in the query.

提交回复
热议问题