我想在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);
答案 0 :(得分:12)
试试这个
Cursor cursor1 = getContentResolver().query(mSmsinboxQueryUri,
projection, "address LIKE ?", new String[]{addressToBeSearched + "%" }, null);