Example usage for android.content ContentValues put

List of usage examples for android.content ContentValues put

Introduction

In this page you can find the example usage for android.content ContentValues put.

Prototype

public void put(String key, byte[] value) 

Source Link

Document

Adds a value to the set.

Usage

From source file:Main.java

private static void insertToSUJamesWeekends(SQLiteDatabase db, String startStopName, String toStopName,
        int timeGap) {
    ContentValues routevalues = new ContentValues();
    routevalues.put("START_STOP_JAMES_TO_SU", startStopName);
    routevalues.put("TO_STOP", toStopName);
    routevalues.put("TIME_GAP", timeGap);
    db.insert("TOSU_JAMES_WEEKEND", null, routevalues);

}

From source file:Main.java

public static int updateItemsFromStateToState(SQLiteDatabase database, Integer original_state,
        Integer new_state) {
    String where_clause = COLUMN_STATE + " = " + original_state;
    ContentValues values = new ContentValues();
    values.put(COLUMN_STATE, new_state);

    int affected = database.update(TABLE_NAME, values, where_clause, null);

    return affected;
}

From source file:Main.java

private static Uri createImageUri(Context context) {
    String name = "boreWbImg" + System.currentTimeMillis();
    ContentValues values = new ContentValues();
    values.put(MediaStore.Images.Media.TITLE, name);
    values.put(MediaStore.Images.Media.DISPLAY_NAME, name + ".jpeg");
    values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
    Uri uri = context.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
    return uri;/*www . ja v a 2s. c o m*/
}

From source file:Main.java

private static void insertGymPlan(SQLiteDatabase db, String machineName, String machineSteps,
        int machineImageId) {
    ContentValues gymPlanValues = new ContentValues();
    gymPlanValues.put("MACHINE_NAME", machineName);
    gymPlanValues.put("EXCERCISE_STEPS", machineSteps);
    gymPlanValues.put("MACHINE_IMAGE_ID", machineImageId);
    db.insert("GYMPLAN", null, gymPlanValues);
}

From source file:Main.java

public static void singleBroadcast(Context context, String filepath) {
    final int DIR_FORMAT = 0x3001; // directory
    Uri MediaUri = MediaStore.Files.getContentUri("external");
    ContentValues values = new ContentValues();
    values.put(MediaStore.MediaColumns.DATA, filepath);
    values.put("format", DIR_FORMAT);
    values.put(MediaStore.MediaColumns.DATE_MODIFIED, System.currentTimeMillis() / 1000);
    context.getContentResolver().insert(MediaUri, values);
}

From source file:Main.java

private static void insertDietPlan(SQLiteDatabase db, String dietName, String dietRecipeSteps,
        int dietImageId) {
    ContentValues dietPlanValues = new ContentValues();
    dietPlanValues.put("DIET_NAME", dietName);
    dietPlanValues.put("RECIPE_STEPS", dietRecipeSteps);
    dietPlanValues.put("DIET_IMAGE_ID", dietImageId);
    db.insert("DIETPLAN", null, dietPlanValues);
}

From source file:Main.java

public static void insert(SQLiteDatabase db, String title, String pubdate, String itemDetail, String link,
        String firstImgUrl, String sectionTitle) {
    ContentValues values = new ContentValues();
    values.put("title", title);
    values.put("pubdate", pubdate);
    values.put("item_detail", itemDetail);
    values.put("link", link);
    values.put("first_img_url", firstImgUrl);
    values.put("table_name", sectionTitle);
    db.insert("favorite_item", null, values);
    db.close();//from w  w w .  j  a v  a  2  s .c om
}

From source file:Main.java

private static void writeBoolean(ContentValues values, String key, boolean value) {
    values.put(key, value ? 1 : 0);
}

From source file:Main.java

private static void insertDrink(SQLiteDatabase db, String name, String description, int resourceID) {

    ContentValues drinkValues = new ContentValues();

    drinkValues.put("NAME", name);
    drinkValues.put("DESCRIPTION", description);
    drinkValues.put("IMAGE_RESOURCE_ID", resourceID);

    db.insert("DRINK", null, drinkValues);

}

From source file:Main.java

private static Uri exportToGallery(Context context, String filename) {
    // Save the name and description of a video in a ContentValues map.
    final ContentValues values = new ContentValues(2);
    values.put(MediaStore.Video.Media.MIME_TYPE, "image/jpeg");
    values.put(MediaStore.Video.Media.DATA, filename);
    // Add a new record (identified by uri)
    final Uri uri = context.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
    return uri;//from  w  w w  .  j av  a2 s .  com
}