Android ContentValues - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ContentValues class.

This code example shows how to use the following methods:put
     * @param developerPayload the developer provided "payload" associated with 
     *     the order. 
     */ 
    private void insertOrder(String orderId, String productId, PurchaseState state,
            long purchaseTime, String developerPayload) {
        ContentValues values = new ContentValues();
        values.put(HISTORY_ORDER_ID_COL, orderId);
        values.put(HISTORY_PRODUCT_ID_COL, productId);
        values.put(HISTORY_STATE_COL, state.ordinal());
        values.put(HISTORY_PURCHASE_TIME_COL, purchaseTime);
        values.put(HISTORY_DEVELOPER_PAYLOAD_COL, developerPayload);
        mDb.replace(PURCHASE_HISTORY_TABLE_NAME, null /* nullColumnHack */, values);
    } 
 
    /** 
     * Updates the quantity of the given product to the given value. If the 
     * given value is zero, then the product is removed from the table. 
     * @param productId the product to update 
     * @param quantity the number of times the product has been purchased 
     */ 
9
CodeRank
This code example shows how to use the following methods:put
  } 
 
  private void insertAddress(long messageId, int type, EncodedStringValue address) {
    if (address != null) {
      SQLiteDatabase database = databaseHelper.getWritableDatabase();
      ContentValues contentValues = new ContentValues();
      contentValues.put(MMS_ID, messageId);
      contentValues.put(TYPE, type);
      contentValues.put(ADDRESS, toIsoString(address.getTextString()));
      contentValues.put(ADDRESS_CHARSET, address.getCharacterSet());
      database.insert(TABLE_NAME, null, contentValues);
    } 
  } 
 
  private void insertAddress(long messageId, int type, EncodedStringValue[] addresses) {
    if (addresses != null) {
      for (int i=0;i<addresses.length;i++) {
        insertAddress(messageId, type, addresses[i]);
      } 
    } 
9
CodeRank
This code example shows how to use the following methods:put
This code example shows how to use the following methods:put
    public void close() { 
        mDbHelper.close();
    } 
 
    public void insertAbstractResult(AbstractResult result, String table) {
        ContentValues cv = new ContentValues();
        cv.put(KEY_PATH, result.getRelativePath());
        cv.put(KEY_BYTES, result.getBytes());
        mDb.insert(table, null, cv);
    } 
 
    public Cursor getAbstractResults(String table) throws SQLException {
        return mDb.query(false, table, new String[] {KEY_BYTES}, null, null, null, null,
                KEY_PATH + " ASC", null);
    } 
 
    public static AbstractResult getAbstractResult(Cursor cursor) {
        return AbstractResult.create(cursor.getBlob(cursor.getColumnIndex(KEY_BYTES)));
    } 
} 
8
CodeRank
This code example shows how to use the following methods:put
		values.put("height", settings.getHeight());
	} 
 
	private void fillPerformanceFlagsContentValues(BookmarkBase.PerformanceFlags perfFlags, ContentValues values)
	{ 
		values.put("perf_remotefx", perfFlags.getRemoteFX());
		values.put("perf_wallpaper", perfFlags.getWallpaper());
		values.put("perf_theming", perfFlags.getTheming());
		values.put("perf_full_window_drag", perfFlags.getFullWindowDrag());
		values.put("perf_menu_animations", perfFlags.getMenuAnimations());
		values.put("perf_font_smoothing", perfFlags.getFontSmoothing());
		values.put("perf_desktop_composition", perfFlags.getDesktopComposition());		
	} 
	 
	private long insertScreenSettings(SQLiteDatabase db, BookmarkBase.ScreenSettings settings) 
	{		 
		ContentValues values = new ContentValues();		
		fillScreenSettingsContentValues(settings, values);
		return db.insertOrThrow("tbl_screen_settings", null, values);
	} 
8
CodeRank
This code example shows how to use the following methods:put
            return; 
        } 
 
        final Long playCount = getPlayCount(songId);
        final SQLiteDatabase database = getWritableDatabase();
        final ContentValues values = new ContentValues(5);
 
        database.beginTransaction();
 
        values.put(FavoriteColumns.ID, songId);
        values.put(FavoriteColumns.SONGNAME, songName);
        values.put(FavoriteColumns.ALBUMNAME, albumName);
        values.put(FavoriteColumns.ARTISTNAME, artistName);
        values.put(FavoriteColumns.PLAYCOUNT, playCount != 0 ? playCount + 1 : 1);
 
        database.delete(FavoriteColumns.NAME, FavoriteColumns.ID + " = ?", new String[] {
            String.valueOf(songId)
        }); 
        database.insert(FavoriteColumns.NAME, null, values);
        database.setTransactionSuccessful();
8
CodeRank
This code example shows how to use the following methods:containsKey, getAsByteArray, putNull
 
    @Override 
    public long insert(SQLiteDatabase db, TransactionContext txContext, long rawContactId,
            ContentValues values) {
 
        if (values.containsKey(SKIP_PROCESSING_KEY)) {
            values.remove(SKIP_PROCESSING_KEY);
        } else { 
            // Pre-process the photo if one exists. 
            if (!preProcessPhoto(values)) {
                return 0; 
            } 
        } 
 
        long dataId = super.insert(db, txContext, rawContactId, values);
        if (!txContext.isNewRawContact(rawContactId)) {
            mContactAggregator.updatePhotoId(db, rawContactId);
        } 
        return dataId;
    } 

8
CodeRank
This code example shows how to use the following methods:getAsString
        public String region;
        public String postcode;
        public String country;
 
        public void fromValues(ContentValues values) {
            street = values.getAsString(StructuredPostal.STREET);
            pobox = values.getAsString(StructuredPostal.POBOX);
            neighborhood = values.getAsString(StructuredPostal.NEIGHBORHOOD);
            city = values.getAsString(StructuredPostal.CITY);
            region = values.getAsString(StructuredPostal.REGION);
            postcode = values.getAsString(StructuredPostal.POSTCODE);
            country = values.getAsString(StructuredPostal.COUNTRY);
        } 
 
        public void toValues(ContentValues values) {
            values.put(StructuredPostal.STREET, street);
            values.put(StructuredPostal.POBOX, pobox);
            values.put(StructuredPostal.NEIGHBORHOOD, neighborhood);
            values.put(StructuredPostal.CITY, city);
            values.put(StructuredPostal.REGION, region);
8
CodeRank
This code example shows how to use the following methods:containsKey, get, put, remove
This code example shows how to use the following methods:put
        mResolver = new ImportTestResolver(androidTestCase);
        mHandler = new VCardEntryCommitter(mResolver);
    } 
 
    public ContentValuesBuilder addExpected(String mimeType) {
        ContentValues contentValues = new ContentValues();
        contentValues.put(Data.MIMETYPE, mimeType);
        mResolver.addExpectedContentValues(contentValues);
        return new ContentValuesBuilder(contentValues);
    } 
 
    public void verifyResolver() { 
        mResolver.verify();
    } 
 
    public void onParsingStart() { 
        mHandler.onStart();
    } 
 
    public void onEntryCreated(VCardEntry entry) {
8
CodeRank

Related Android ContentValues Questions & Answers:

Other Android ContentValues Examples

62:	
63:	  protected void addRecordingToMediaLibrary() {
64:	    ContentValues values = new ContentValues(4);
65:	    long current = System.currentTimeMillis();
66:	    values.put(MediaStore.Audio.Media.TITLE, "audio" + audiofile.getName());
-
62:	
63:	  protected void addRecordingToMediaLibrary() {
64:	    ContentValues values = new ContentValues(4);
65:	    long current = System.currentTimeMillis();
66:	    values.put(MediaStore.Audio.Media.TITLE, "audio" + audiofile.getName());

Read More

4:			SQLiteDatabase db = this.getWritableDatabase();
5:	
6:			ContentValues values = new ContentValues();
7:			values.put(KEY_TODO_ID, todo_id);
8:			values.put(KEY_TAG_ID, tag_id);
-
4:			SQLiteDatabase db = this.getWritableDatabase();
5:	
6:			ContentValues values = new ContentValues();
7:			values.put(KEY_TODO_ID, todo_id);
8:			values.put(KEY_TAG_ID, tag_id);

Read More

2:			SQLiteDatabase db = this.getWritableDatabase();
3:	
4:			ContentValues values = new ContentValues();
5:			values.put(KEY_NAME, contact.getName()); // Contact Name
6:			values.put(KEY_PH_NO, contact.getPhoneNumber()); // Contact Phone Number
-
2:			SQLiteDatabase db = this.getWritableDatabase();
3:	
4:			ContentValues values = new ContentValues();
5:			values.put(KEY_NAME, contact.getName()); // Contact Name
6:			values.put(KEY_PH_NO, contact.getPhoneNumber()); // Contact Phone Number

Read More

4:			SQLiteDatabase db = this.getWritableDatabase();
5:	
6:			ContentValues values = new ContentValues();
7:			values.put(KEY_TAG_ID, tag_id);
8:	
-
4:			SQLiteDatabase db = this.getWritableDatabase();
5:	
6:			ContentValues values = new ContentValues();
7:			values.put(KEY_TAG_ID, tag_id);
8:

Read More

See Code Examples for Android ContentValues Methods: