FANDOM



The ContentValues object is metadata that can be associated with a ContentProvider record

Uri imageFileUri = getContentResolver().insert(
Media.EXTERNAL_CONTENT_URI, new ContentValues());



ContentValues takes data as name-value pairs. The names are standard and defined as constants in the android.provider.MediaStore.Images.Media class.



ContentValues contentValues = new ContentValues(3);
contentValues.put(Media.DISPLAY_NAME, "This is a test title");
contentValues.put(Media.DESCRIPTION, "This is a test description");
contentValues.put(Media.MIME_TYPE, "image/jpeg");

Uri imageFileUri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI,�
contentValues);


Updating a record with Title and DescriptionEdit


ContentValues contentValues = new ContentValues(3);
contentValues.put(Media.DISPLAY_NAME, "This is a test title");
contentValues.put(Media.DESCRIPTION, "This is a test description");
getContentResolver().update(imageFileUri,contentValues,null,null);