使用Android sqlite进行模糊查询

(1)使用db.query方法查询
// select * from users where name like %searcherFilter% ;
public List< queryByLike(String searcherFilter) 
{                
 Cursor cursor = db.query(TABLE_NAME, null, "name like '%" + searcherFilter + "%'", null, null, null, null);
 或者 
 Cursor cursor = db.query(TABLE_NAME, null, "name like ?", new String[]{"%"+searcherFilter+"%"}, null, null, null); 

}
(2)使用

Cursor cursor=db.execure("select * from table_name where name like '%"+searcherFilter "%'")

你可能感兴趣的:(android,sqlite,Cursor,模糊查)