update with ContentValues and SQLiteDatabase - Android Database

Android examples for Database:ContentValues

Description

update with ContentValues and SQLiteDatabase

Demo Code


//package com.java2s;
import android.content.ContentValues;

import android.database.sqlite.SQLiteDatabase;

public class Main {
    private static final String TABLE_NAME2 = "OTHER";

    public static void update_Other(SQLiteDatabase db, int userid,
            String name) {/*from w  w w .j a  va 2  s  .  c  om*/
        ContentValues cv = new ContentValues();
        cv.put("USER_ID", userid);
        cv.put("OTHER_NAME", name);
        db.update(TABLE_NAME2, cv, "id = 1", null);
    }
}

Related Tutorials