Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.activeandroid.ActiveAndroid;
- import com.activeandroid.Cache;
- import com.activeandroid.Model;
- import com.activeandroid.TableInfo;
- public abstract class BaseModel extends Model {
- public static final String _RID = "remote_id";
- public int getRemoteId() {
- return -1;
- }
- public static void truncate(Class<? extends Model> type) {
- try {
- TableInfo tableInfo = Cache.getTableInfo(type);
- ActiveAndroid.execSQL("delete from " + tableInfo.getTableName() + ";");
- ActiveAndroid.execSQL("delete from sqlite_sequence where name='" + tableInfo.getTableName() + "';");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment