Add value to SQLiteDatabase by ContentValues - Android Database

Android examples for Database:ContentValues

Description

Add value to SQLiteDatabase by ContentValues

Demo Code

/**//  w  w w.j  a v a 2  s. c  o  m
 * Copyright (c) 2014, German Neuroinformatics Node (G-Node)
 * Copyright (c) 2014, Shumail Mohy-ud-Din <shumailmohyuddin@gmail.com>
 * Copyright (c) 2013, Yasir Adnan <adnan.ayon@gmail.com> 
 * License: BSD-3 (See LICENSE)
 */
//package com.java2s;
import android.content.ContentValues;

import android.database.sqlite.SQLiteDatabase;

import android.util.Log;

public class Main {
    public static SQLiteDatabase database;
    public static final String TABLE_ABSTRACT_FAVORITES = "ABSTRACT_FAVORITES";

    public static void addInABSTRACT_FAVORITES(String abstract_uuid) {

        ContentValues values = new ContentValues();

        values.put("ABSTRACT_UUID", abstract_uuid);

        long abs_fav_id = database.insert(TABLE_ABSTRACT_FAVORITES, null,
                values);
    }
}

Related Tutorials