askIT

Delete (Android SQLite)

One can either delete a single row or all rows in a table. Methods for deleting programmed into the class DBadapter. Then you can make queries to DBadapter from MainActivity.

DBadapter delete one row

// Delete a particular record
public int deleteRecordNote(long rowID) throws SQLException {
        return db.delete(databaseTableNotes, "note_id="+rowID, null);
}

DBadapter delete all rows

// Delete a all rows
public int truncateNotes() {
        return db.delete(databaseTableNotes, "1", null);
}

Add comment

avatar_blank_60.png

Comment:

Name:

Email:

Comments

No comments yet. You can be the first one to comment. Just write your comment in the form and click on the submit button.