reset Auto Increment in SQLiteDatabase - Android Database

Android examples for Database:Auto Incremental ID

Description

reset Auto Increment in SQLiteDatabase

Demo Code


//package com.java2s;

import android.database.sqlite.SQLiteDatabase;

public class Main {
    public static void resetAutoIncrement(SQLiteDatabase db, String name) {
        String[] whereArgs = { name };
        db.delete("sqlite_sequence", "name = ?", whereArgs);
    }//from  ww w.  j  ava 2 s.  c  om

    public static int delete(SQLiteDatabase db, String name, int id) {
        String[] whereArgs = { String.valueOf(id) };
        return db.delete(name, "id = ?", whereArgs);
    }
}

Related Tutorials