Add ContentValues to SQLiteDatabase - Android Database

Android examples for Database:ContentValues

Description

Add ContentValues to SQLiteDatabase

Demo Code


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

import android.database.sqlite.SQLiteDatabase;

public class Main {
    private static void insertAccount(SQLiteDatabase db, String name,
            String login, String Password, String QUESTION_1,
            String QUESTION_2, String QUESTION_3, String notes) {

        ContentValues accountValues = new ContentValues();
        accountValues.put("NAME", name);
        accountValues.put("LOGIN", login);
        accountValues.put("PASSWORD", Password);
        accountValues.put("QUESTION_1", QUESTION_1);
        accountValues.put("QUESTION_2", QUESTION_2);
        accountValues.put("QUESTION_3", QUESTION_3);
        accountValues.put("NOTES", notes);
        db.insert("Account", null, accountValues);
    }//from w  w w  . ja v  a  2s .  c  o  m
}

Related Tutorials