Hope this helps someone who uses Active Android.
there is an easy way to delete all records in a table.
1) First create the "TruncatableModel" class and extend all your models to this class
public abstract class TruncatableModel extends Model { public static void truncate(Class<? extends Model> type){ final String tableName = Cache.getTableInfo(type).getTableName();
..so after extension my model class will look like.
@Table(name = "note") public class Note extends TruncatableModel { @Column(name ="idn") public Integer idn; @Column(name ="title") public String title; ... }
2) Now I can delete all entries in the "note" database using this code.
Note.truncate(Note.class);
This seems like a more efficient way than any other methods I've tried.
source share