Clear database table

0

I use this method to delete a bank record

public boolean delete(String id) {
    String where = "id = ?";
    String[] whereArgs = new String[] {id};

    int retorno = this.banco.delete("pessoa", where, whereArgs);

    if(retorno != 0)
        return true;
    else
        return false;
}

Now I need to create one that erases all records, does anyone know?

    
asked by anonymous 01.12.2014 / 19:49

1 answer

1

Try this, remove where different from NULL. As every record should probably have an id, then it will remove all.

String where = "id IS NOT NULL";

public boolean deleteAll() {
    String where = "id IS NOT NULL";
    this.banco.delete("pessoa", where, null);
}
    
01.12.2014 / 19:51