SQLite Cursor return NULL if no record found in Android -


i have problem today retrieving data sqlite. here coding

public cursor fetchdictionary(string searchword) throws sqlexception {     cursor mcursor =         mdb.query(true, database_table, new string[] {key_rowid,                 key_word, key_def}, key_word + "='" + searchword + "'", null,                 null, null, null, null);     if (mcursor != null) {         mcursor.movetofirst();     }     return mcursor; } 

above coding if no record found, android prompt dialogbox , force close. there way return "no record found" error message if no record found?

do try catch, , replace e.printstacktrace() messages.


Comments