I am writing an Android simple To Do list app for learning purposes.
This is my function which updates the UI with the list items:
private void updateUI() {
helper = new TaskDBHelper(MainActivity.this);
SQLiteDatabase sqlDB = helper.getReadableDatabase();
Cursor cursor = sqlDB.query(TaskContract.TABLE,
new String[]{TaskContract.Columns._ID, TaskContract.Columns.TASK },//, TaskContract.Columns.DESCRIPTION},
null, null, null, null, null);
listAdapter = new SimpleCursorAdapter(
this,
R.layout.task_view,
cursor,
new String[]{TaskContract.Columns.TASK}, //TaskContract.Columns.DESCRIPTION },
new int[]{R.id.taskTextView},
0
);
this.setListAdapter(listAdapter);
}
I need an SQlite statement to delete the last item from the list. As I am new to Android, any help would be appreciated, thanks.