search a value from sqlite database and retrieve in listview

前端 未结 3 629
一生所求
一生所求 2020-12-05 22:02

How to find the exact data in sqlite database and retrieve it in a listactivity? I tried like this but I didn\'t get the value.

sea         


        
3条回答
  •  無奈伤痛
    2020-12-05 22:47

    In your sqliteconnecter create a method and call that method from your respective class. Now type the following code in ur sqlite class.

    Cursor cusror;
    
    cursor=db.rawQuery("SELECT * FROM "+ Contactsnew.TABLE02 + " WHERE " 
                    + Contactsnew.userid + " = " + Contactsnew.userId + " AND " + Contactsnew.TITLE +
                     " LIKE  '"+search.getText()+"%'");
    

    print the query in a string and check whether you are getting the correct values, then return the cursor.

    try this and say!!

提交回复
热议问题