List of usage examples for android.content ContentValues put
public void put(String key, byte[] value)
From source file:gxu.software_engineering.market.android.util.Processor.java
public static ContentValues toCategory(JSONObject json) throws JSONException { ContentValues values = new ContentValues(); values.put(C._ID, json.getLong(C.ID)); values.put(C.category.NAME, json.getString(C.category.NAME)); values.put(C.category.EXTRA, json.getString(C.category.EXTRA)); values.put(C.category.ADDED_TIME, json.getLong(C.category.ADDED_TIME)); values.put(C.category.DESCRIPTION, json.getString(C.category.DESCRIPTION)); return values; }
From source file:gxu.software_engineering.market.android.util.Processor.java
public static ContentValues toUser(JSONObject json) throws JSONException { ContentValues values = new ContentValues(); values.put(C._ID, json.getLong(C.ID)); values.put(C.user.ACCOUNT, json.getString(C.user.ACCOUNT)); values.put(C.user.CONTACT, json.getString(C.user.CONTACT)); values.put(C.user.LAST_LOGIN_TIME, json.getLong(C.user.LAST_LOGIN_TIME)); values.put(C.user.LOGIN_TIMES, json.getLong(C.user.LOGIN_TIMES)); values.put(C.user.REAL_NAME, json.getString(C.user.REAL_NAME)); values.put(C.user.NICK, json.getString(C.user.NICK)); values.put(C.user.REGISTER_TIME, json.getLong(C.user.REGISTER_TIME)); return values; }
From source file:Main.java
private static void writeLong(ContentValues values, String key, Long value) { if (value == null) { values.putNull(key);/*from w w w.jav a 2 s . c om*/ } else { values.put(key, value); } }
From source file:Main.java
private static void writeInteger(ContentValues values, String key, Integer value) { if (value == null) { values.putNull(key);/*from ww w. ja v a 2 s . co m*/ } else { values.put(key, value); } }
From source file:Main.java
private static void writeString(ContentValues values, String key, String value) { if (value == null) { values.putNull(key);//from w w w. j a v a 2 s . c o m } else { values.put(key, value); } }
From source file:Main.java
private static void safePut(ContentValues values, String key, String value) { if (value == null) { values.putNull(key);/*from w w w .j ava2 s . c om*/ } else { values.put(key, value); } }
From source file:Main.java
public static void shiftTableIdsExceptWhen(HashMap<String, ArrayList<ContentValues>> operationMap, String tableName, String idColumnName, long topTableId, String exceptionColumn, String exceptionValue) { ArrayList<ContentValues> restoreOperations = operationMap.get(tableName); if (null == restoreOperations || null == exceptionValue) { return;// w w w.j a v a 2s .co m } for (ContentValues restoreCv : restoreOperations) { if (!exceptionValue.equals(restoreCv.getAsString(exceptionColumn))) { restoreCv.put(idColumnName, restoreCv.getAsLong(idColumnName) + topTableId); } } }
From source file:co.rewen.statex.AsyncLocalStorageUtil.java
/** * Sets the value for the key given, returns true if successful, false otherwise. *///from w w w.j a v a 2 s. c o m /* package */ static boolean setItemImpl(SQLiteDatabase db, String key, String value) { ContentValues contentValues = new ContentValues(); contentValues.put(KEY_COLUMN, key); contentValues.put(VALUE_COLUMN, value); long inserted = db.insertWithOnConflict(TABLE_STATE, null, contentValues, SQLiteDatabase.CONFLICT_REPLACE); return (-1 != inserted); }
From source file:edu.stanford.mobisocial.dungbeetle.feed.objects.SharedSecretObj.java
public static byte[] getOrPushSecret(Context context, Contact other) { if (other.secret != null) { return other.secret; }/* w ww. ja v a2 s . c o m*/ //TODO: this really needs to be refactored into the contentprovider/helpers etc ContentValues values = new ContentValues(); byte[] ss = new byte[32]; random.nextBytes(ss); values.put(Contact.SHARED_SECRET, ss); context.getContentResolver().update(Uri.parse(DungBeetleContentProvider.CONTENT_URI + "/contacts"), values, "_id=?", new String[] { String.valueOf(other.id) }); Helpers.sendMessage(context, other.id, json(ss), TYPE); return ss; }
From source file:com.rukman.emde.smsgroups.platform.GMSContactOperations.java
/** * When we first add a sync adapter to the system, the contacts from that * sync adapter will be hidden unless they're merged/grouped with an existing * contact. But typically we want to actually show those contacts, so we * need to mess with the Settings table to get them to show up. * * @param context the Authenticator Activity context * @param account the Account who's visibility we're changing * @param visible true if we want the contacts visible, false for hidden *///from w ww. j av a2 s. co m public static void setAccountContactsVisibility(Context context, Account account, boolean visible) { ContentValues values = new ContentValues(); values.put(RawContacts.ACCOUNT_NAME, account.name); values.put(RawContacts.ACCOUNT_TYPE, GMSApplication.ACCOUNT_TYPE); values.put(Settings.UNGROUPED_VISIBLE, visible ? 1 : 0); context.getContentResolver().insert(Settings.CONTENT_URI, values); }