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.
Please try (I suppose that mail is String object):
Cursor cursor = context.getContentResolver().query(ContactsContract.CommonDataKinds.Email.CONTENT_URI,
new String[] {Contacts._ID}, "lower("+ContactsContract.CommonDataKinds.Email.ADDRESS + ")=lower('"+ email +"')",
null, null);
or
Cursor cursor = context.getContentResolver().query(ContactsContract.CommonDataKinds.Email.CONTENT_URI,
new String[] {Contacts._ID}, "lower("+ContactsContract.CommonDataKinds.Email.ADDRESS + ")=lower('"+ email +"')",
new String[] {}, null);
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.
Cursor cursor = this.db.query("UserTbl", new String[] {"UserId",
"Username", "Password" },
"Username = ? COLLATE NOCASE AND Password = ? COLLATE NOCASE", new String[] { userNameString,
passwordString }, null, null, null);