set Initial Values to ContentValues - Android Database

Android examples for Database:ContentValues

Description

set Initial Values to ContentValues

Demo Code


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

import android.database.sqlite.SQLiteDatabase;

public class Main {
    private static void setInitialValues(SQLiteDatabase db) {

        ContentValues sponsorValues = new ContentValues();
        sponsorValues.put("NAME", "V");
        sponsorValues.put("PHONENO", (Integer) 0000);

        ContentValues userValues = new ContentValues();
        userValues.put("FIRSTNAME", "N");
        userValues.put("LASTNAME", "E");
        userValues.put("SOBERDAY", 01);
        userValues.put("SOBERMONTH", 01);
        userValues.put("SOBERYEAR", 1970);

        ContentValues goalValues = new ContentValues();
        goalValues.put("GOAL", "M");
        goalValues.put("DESCRIPTION", "N");
        goalValues.put("GOALDAY", 01);
        goalValues.put("GOALMONTH", 01);
        goalValues.put("GOALYEAR", 1970);
        goalValues.put("ISDONE", 0);

        db.insert("SPONSOR", null, sponsorValues);
        db.insert("USER", null, userValues);
        db.insert("GOAL", null, goalValues);
    }// w  w  w  .  j  a  va 2s. c o  m
}

Related Tutorials