i want to make “clear-all” button which delete all data in my sqlite, my code is like this :
private void clearAll() {
mDbHelper = new NotesDbAdapter(this);
mDbHelper.open();
Cursor notesCursor = mDbHelper.fetchAllNotes();
notesCursor.moveToFirst();
do{
for(int i=0;i<notesCursor.getCount();i++){
mDbHelper.deleteNote(i);
}
}while(notesCursor.moveToNext());
}
but i can’t delete it, anyone can help me to solve this problem? thanks before
you should be able to use something like this:
To delete all the values in your table and update your cursor.