delete All row by id via SQLiteDatabase - Android Database

Android examples for Database:Table Row Delete

Description

delete All row by id via SQLiteDatabase

Demo Code


//package com.java2s;

import android.database.sqlite.SQLiteDatabase;

public class Main {
    public static void deleteAll(SQLiteDatabase db, String name) {
        db.delete(name, null, null);//from   ww  w . j a va 2 s  .com
    }

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

Related Tutorials