我想在where子句中添加contains()方法的功能.现在我做的事情就像“地址=?”并在参数中提供地址,但现在我想使用一个逻辑作为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,"address LIKE ?",new String[]{addressToBeSearched + "%" },null);