java - While clicking search,my application has stopped -


i using searching,to show listview contents.while clicking search functionality or type data,it shows application has stopped.

mainactivity.java

@suppresslint("newapi")      @suppresswarnings("deprecation")        private void filldata(cursor projectscursor) {            //mdbhelper.open();                if(projectscursor!=null)            {            string[] = new string[]{ginfydbadapter.category_column_title, ginfydbadapter.category_column_content, ginfydbadapter.category_column_count};            int[] = new int[]{r.id.text2, r.id.text1, r.id.count};             dataadapter  = new simplecursoradapter(              this, r.layout.activity_row,               projectscursor,               from,               to,              0);             setlistadapter(dataadapter);              edittext myfilter = (edittext) findviewbyid(r.id.myfilter);               myfilter.addtextchangedlistener(new textwatcher() {                 public void aftertextchanged(editable s) {                }                 public void beforetextchanged(charsequence s, int start,                   int count, int after) {                }                 public void ontextchanged(charsequence s, int start,                   int before, int count) {                    dataadapter.getfilter().filter(s.tostring());                }               });                dataadapter.setfilterqueryprovider(new filterqueryprovider() {                      public cursor runquery(charsequence constraint) {                          return mdbhelper.fetchprojectbyname(constraint.tostring());                      }                  }); 

this db.java

 public cursor fetchprojectbyname(string inputtext) throws sqlexception {           log.w(tag, inputtext);           cursor mcursor = null;           if (inputtext == null  ||  inputtext.length () == 0)  {            mcursor = mdb.query(database_table_proj, new string[] {category_column_id,                  category_column_content},               null, null, null, null, null);            }           else {            mcursor = mdb.query(true, database_table_proj, new string[] {category_column_id,                  category_column_content},                  category_column_content + " '%" + inputtext + "%'", null,              null, null, null, null);           }           if (mcursor != null) {            mcursor.movetofirst();           }           return mcursor;           } 

using db in fetchproject name want search contents of listview match according search option.it shows logcaterror. while typing or clicking search area,it shows applicaton has stopped.

this logcat error.

07-15 12:23:08.688: e/androidruntime(25812): fatal exception: main 07-15 12:23:08.688: e/androidruntime(25812): java.lang.illegalargumentexception: column 'title' not exist 07-15 12:23:08.688: e/androidruntime(25812):    @ android.database.abstractcursor.getcolumnindexorthrow(abstractcursor.java:303) 07-15 12:23:08.688: e/androidruntime(25812):    @ android.widget.simplecursoradapter.findcolumns(simplecursoradapter.java:333) 07-15 12:23:08.688: e/androidruntime(25812):    @ android.widget.simplecursoradapter.swapcursor(simplecursoradapter.java:345) 07-15 12:23:08.688: e/androidruntime(25812):    @ android.widget.cursoradapter.changecursor(cursoradapter.java:309) 07-15 12:23:08.688: e/androidruntime(25812):    @ android.widget.cursorfilter.publishresults(cursorfilter.java:67) 07-15 12:23:08.688: e/androidruntime(25812):    @ android.widget.filter$resultshandler.handlemessage(filter.java:282) 07-15 12:23:08.688: e/androidruntime(25812):    @ android.os.handler.dispatchmessage(handler.java:99) 07-15 12:23:08.688: e/androidruntime(25812):    @ android.os.looper.loop(looper.java:137) 07-15 12:23:08.688: e/androidruntime(25812):    @ android.app.activitythread.main(activitythread.java:5039) 07-15 12:23:08.688: e/androidruntime(25812):    @ java.lang.reflect.method.invokenative(native method) 07-15 12:23:08.688: e/androidruntime(25812):    @ java.lang.reflect.method.invoke(method.java:511) 07-15 12:23:08.688: e/androidruntime(25812):    @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) 07-15 12:23:08.688: e/androidruntime(25812):    @ com.android.internal.os.zygoteinit.main(zygoteinit.java:560) 07-15 12:23:08.688: e/androidruntime(25812):    @ dalvik.system.nativestart.main(native method) 

add title column in query.

mcursor = mdb.query(database_table_proj,  new string[]{category_column_id,category_column_title, category_column_content},  null, null, null, null, null); 

Comments