I have problem today about retrieving data from SQLite. Here is my 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 and force to close. Is there any way to return “no record found” error message if no record found?
Do a try catch, and replace the
e.printStackTrace()with your messages.