List of usage examples for android.content ContentValues ContentValues
public ContentValues()
From source file:Main.java
private static void insertDataTopic(SQLiteDatabase db, String section, String name, String url, int resourceId) { ContentValues values = new ContentValues(); values.put("SECTION", section); values.put("NAME", name); values.put("URL", url); values.put("IMAGE_RESOURCE_ID", resourceId); db.insert("TOPIC", null, values); }
From source file:Main.java
private static void insertDrink(SQLiteDatabase db, String name, String description, int resourceId) { //this method was created to ContentValues drinkValues = new ContentValues(); //... insert several drink rows drinkValues.put("NAME", name); drinkValues.put("DESCRIPTION", description); drinkValues.put("image_id", resourceId); db.insert("DRINK", null, drinkValues); }
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
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
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 ContentValues getConvInt(String key, int value) { if (mConv != null) { mConv = null;//from w w w .j a va2s . c o m } mConv = new ContentValues(); mConv.put(key, value); return mConv; }
From source file:Main.java
public static ContentValues getConvLong(String key, Long value) { if (mConv != null) { mConv = null;//from w w w. j a va 2 s.co m } mConv = new ContentValues(); mConv.put(key, value); return mConv; }
From source file:Main.java
public static void insertCompany(SQLiteDatabase db, String name, String email, String password, String phone, String address) {// w w w. j ava 2s . c o m ContentValues companyValues = new ContentValues(); companyValues.put("NAME", name); companyValues.put("EMAIL", email); companyValues.put("PASSWORD", password); companyValues.put("PHONE", phone); companyValues.put("ADDRESS", address); companyValues.put("ACTIVO", "ACTIVO"); db.insert("COMPANY", null, companyValues); }
From source file:Main.java
public static ContentValues getConvString(String key, String value) { if (mConv != null) { mConv = null;//from ww w . j a v a2s . c o m } mConv = new ContentValues(); mConv.put(key, value); return mConv; }
From source file:Main.java
public static ContentValues listToContentValues(List<String> values, String type) { ContentValues contentvalues = new ContentValues(); //Place values into contentvalue structure for (int i = 0; i < values.size(); i++) { String current = values.get(i); try {//ww w. j ava 2 s . c o m //Separate the value by = in order to get key:value Integer indexOfEquals = current.indexOf("="); String key = current.substring(0, indexOfEquals); String value = current.substring(indexOfEquals + 1); if (type.toUpperCase().equals("STRING")) contentvalues.put(key, value); if (type.toUpperCase().equals("BOOLEAN")) contentvalues.put(key, Boolean.valueOf(value)); if (type.toUpperCase().equals("INTEGER")) contentvalues.put(key, new Integer(value)); if (type.toUpperCase().equals("DOUBLE")) contentvalues.put(key, new Double(value)); if (type.toUpperCase().equals("FLOAT")) contentvalues.put(key, new Float(value)); if (type.toUpperCase().equals("LONG")) contentvalues.put(key, new Long(value)); if (type.toUpperCase().equals("SHORT")) contentvalues.put(key, new Short(value)); } catch (Exception e) { Log.e("mercury", "Error with argument " + current); } } return contentvalues; }