Ya está disponible la segunda Vista previa para desarrolladores de Android 11; pruébala y comparte tus comentarios.

ImageCapture.OutputFileOptions.Builder

public static final class ImageCapture.OutputFileOptions.Builder
extends Object

java.lang.Object
   ↳ androidx.camera.core.ImageCapture.OutputFileOptions.Builder


Builder class for ImageCapture.OutputFileOptions.

Summary

Public constructors

ImageCapture.OutputFileOptions.Builder(File file)

Creates options to write captured image to a File.

ImageCapture.OutputFileOptions.Builder(ContentResolver contentResolver, Uri saveCollection, ContentValues contentValues)

Creates options to write captured image to MediaStore.

ImageCapture.OutputFileOptions.Builder(OutputStream outputStream)

Creates options that write captured image to a OutputStream.

Public methods

ImageCapture.OutputFileOptions build()

Builds ImageCapture.OutputFileOptions.

ImageCapture.OutputFileOptions.Builder setMetadata(ImageCapture.Metadata metadata)

Sets the metadata to be stored with the saved image.

Inherited methods

Public constructors

ImageCapture.OutputFileOptions.Builder

public ImageCapture.OutputFileOptions.Builder (File file)

Creates options to write captured image to a File.

Parameters
file File: save location of the image.

ImageCapture.OutputFileOptions.Builder

public ImageCapture.OutputFileOptions.Builder (ContentResolver contentResolver, 
                Uri saveCollection, 
                ContentValues contentValues)

Creates options to write captured image to MediaStore. Example:

ContentValues contentValues = new ContentValues();
 contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, "NEW_IMAGE");
 contentValues.put(MediaStore.MediaColumns.MIME_TYPE, "image/jpg");

 ImageCapture.OutputFileOptions options = new ImageCapture.OutputFileOptions.Builder(
         getContentResolver(),
         MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
         contentValues).build();

 

Parameters
contentResolver ContentResolver: to access MediaStore

saveCollection Uri: The URL of the table to insert into.

contentValues ContentValues: to be included in the created image file.

ImageCapture.OutputFileOptions.Builder

public ImageCapture.OutputFileOptions.Builder (OutputStream outputStream)

Creates options that write captured image to a OutputStream.

Parameters
outputStream OutputStream: save location of the image.

Public methods

setMetadata

public ImageCapture.OutputFileOptions.Builder setMetadata (ImageCapture.Metadata metadata)

Sets the metadata to be stored with the saved image.

For JPEG this will be included in the EXIF.

Parameters
metadata ImageCapture.Metadata: Metadata to be stored with the saved image. For JPEG this will be included in the EXIF.

Returns
ImageCapture.OutputFileOptions.Builder