6

我想contains()在 where 子句中添加方法的功能。现在我正在做类似的事情,"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);
4

1 回答 1

14

尝试这个

Cursor cursor1 = getContentResolver().query(mSmsinboxQueryUri,
                projection, "address LIKE ?", new String[]{addressToBeSearched + "%" }, null);
于 2013-05-27T11:03:33.827 回答