delete item from cache table via SQLiteDatabase - Android Database

Android examples for Database:Table Row Delete

Description

delete item from cache table via SQLiteDatabase

Demo Code


//package com.book2s;

import android.database.sqlite.SQLiteDatabase;

public class Main {
    static final String TABLE_NAME = "cache_data";
    static final String FIELD_SET_NAME = "set_name";
    static final String FIELD_VALUE = "value";

    public static boolean delete(SQLiteDatabase db, String key, String value) {
        return db.delete(TABLE_NAME, FIELD_SET_NAME + "= ?," + FIELD_VALUE
                + "=?", new String[] { key, value }) == 0 ? false : true;
    }//from   ww  w  . ja va  2 s  .com
}

Related Tutorials