I am developing an app in which suggestive list is displayed as I start typing in SearchView
. Everything is going well but as I type in SearchView
the App just crashes.
public Cursor searchByBrandText(String inputTextBrand) throws SQLException {
db = this.getReadableDatabase();
String where = inputTextBrand;
String extra = "'%" + where + "%'";
String query = "SELECT Brand_Name" + " from " + "Sample" + " where "
+ "Brand_Name" + " LIKE " + extra;
Cursor mCursor = db.rawQuery(query, null);
if (mCursor.getCount() <= 0) {
mCursor.close();
return null;
} else {
return mCursor;
}
}