I want to set the condition on the Cursor that if certain data not found in the database return String NOT FOUND.
static class NoteHolder {
private TextView noteText = null;
NoteHolder(View row) {
noteText = (TextView) row.findViewById(R.id.notecontent);
}
void populateFrom(Cursor c, NoteHelper helper) {
noteText.setText(helper.getAnswer(c));
}
}
MY Database Helper Code Is
public Cursor getAll() {
return (getReadableDatabase().rawQuery(
"SELECT _id,Answer From Q_A Where Answer like '%"
+ searchcontent + "%'", null));
}
public String getAnswer(Cursor c) {
return (c.getString(1));
}
http://commonsware.com/warescription have a brilliant collection of books (they’re not free, but the price is VERY good, plus you get free updates!)