insert with ContentValues and SQLiteDatabase - Android Database

Android examples for Database:ContentValues

Description

insert 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 insert_Other(SQLiteDatabase db, int userid,
            String name) {/* ww w  .j  a v  a2s. co  m*/
        ContentValues cv = new ContentValues();
        cv.put("USER_ID", userid);
        cv.put("OTHER_NAME", name);
        db.insert(TABLE_NAME2, null, cv);
    }
}

Related Tutorials