Getting the result of cursor and turning it into a string for TextView Getting the result of cursor and turning it into a string for TextView sqlite sqlite

Getting the result of cursor and turning it into a string for TextView


try like this:

keep the column index as 0 because that cursor will have only one column.

DatabaseHelper db = new DatabaseHelper(this);String str = "";    if (c!= null) {        if (c.moveToFirst()) {            str = c.getString(0);        }    }TextView.setText(str);


You are attempting to use the index of db.colDateDue. However, that does not correlate with your actual query. You can happily pull the first result with:

str = c.getString(0);