SQL query in Android - search for whole or part of a string

后端 未结 2 452
梦谈多话
梦谈多话 2021-01-24 09:36

I\'m not experienced with SQL queries too much so I\'m having some trouble in finding the solution to my problem.

I have a list of Bookmarks, for example: Facebook, Deve

2条回答
  •  粉色の甜心
    2021-01-24 10:10

    You can try this:

    String where = Browser.BookmarkColumns.TITLE + " LIKE '%" + x +"%' OR "
                + Browser.BookmarkColumns.URL + " LIKE '%" + x +"%'";
                where = "(" + where + ") AND " + Browser.BookmarkColumns.BOOKMARK + " == 1";
    

    where x is the text that user has inserted, i.e. face.

    Hope this helps!

提交回复
热议问题