我想在 where 子句中添加 contains()
方法的功能。现在我正在做类似 "address = ?"
的事情,并在参数中提供地址,但现在我想使用一个作为 address.contains(?)
的逻辑,然后在参数中提供地址。我该如何实现?
到目前为止,我的代码是并且需要知道需要修改。
Uri mSmsinboxQueryUri = Uri.parse("content://sms");
String[] projection = new String[] { "_id", "thread_id", "address",
"person", "date", "body", "type" };
Cursor cursor1 = getContentResolver().query(mSmsinboxQueryUri,
projection, "address = ?", new String[]{addressToBeSearched}, null);
最佳答案
试试这个
Cursor cursor1 = getContentResolver().query(mSmsinboxQueryUri,
projection, "address LIKE ?", new String[]{addressToBeSearched + "%" }, null);
关于android - Android 中 contentProvider 查询中的 where 子句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16771636/