This question already has an answer here:
Why do we have to move to the first item in the code below? I thought the cursor would only contain one row since the rowId is a primary key
// Fetch single reminder
@SuppressLint("NewApi")
public Cursor fetchReminder(long rowId) throws SQLException {
Cursor myCursor = db.query(true, DATABASE_TABLE, new String[] {
KEY_ROW_ID, KEY_TITLE, KEY_BODY, KEY_DATE_TIME }, KEY_ROW_ID
+ "=" + rowId, null, null, null, null, null, null);
if (myCursor != null) {
myCursor.moveToFirst();
}
return myCursor;
}
Aucun commentaire:
Enregistrer un commentaire