update Profile with ContentValues and SQLiteDatabase - Android Database

Android examples for Database:ContentValues

Description

update Profile 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_NAME = "USER";

    public static void update_Profile(SQLiteDatabase db, int userid,
            String name, int height, int weight, String rent,
            String bloodtype, String revenue, String birthplace,
            String job, String birthday) {
        ContentValues cv = new ContentValues();
        cv.put("USER_ID", userid);
        cv.put("NAME", name);
        cv.put("HEIGHT", height);
        cv.put("WEIGHT", weight);
        cv.put("RENT", rent);
        cv.put("BLOODTYPE", bloodtype);
        cv.put("REVENUE", revenue);
        cv.put("BIRTHPLACE", birthplace);
        cv.put("JOB", job);
        cv.put("BIRTHDAY", birthday);
        db.update(TABLE_NAME, cv, "id = 1", null);
    }//  w ww  .  java  2  s  . com
}

Related Tutorials