Stay organized with collections Save and categorize content based on your preferences.

ImageCapture.OutputFileOptions.Builder

public final class ImageCapture.OutputFileOptions.Builder


Builder class for OutputFileOptions.

Summary

Public constructors

Creates options to write captured image to a File.

Builder(@NonNull OutputStream outputStream)

Creates options that write captured image to a OutputStream.

Builder(
    @NonNull ContentResolver contentResolver,
    @NonNull Uri saveCollection,
    @NonNull ContentValues contentValues
)

Creates options to write captured image to MediaStore.

Public methods

@NonNull ImageCapture.OutputFileOptions

Builds OutputFileOptions.

@NonNull ImageCapture.OutputFileOptions.Builder

Sets the metadata to be stored with the saved image.

Public constructors

Builder

public Builder(@NonNull File file)

Creates options to write captured image to a File.

Parameters
@NonNull File file

save location of the image.

Builder

public Builder(@NonNull OutputStream outputStream)

Creates options that write captured image to a OutputStream.

Parameters
@NonNull OutputStream outputStream

save location of the image.

Builder

public Builder(
    @NonNull ContentResolver contentResolver,
    @NonNull Uri saveCollection,
    @NonNull 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/jpeg");

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

Parameters
@NonNull ContentResolver contentResolver

to access MediaStore

@NonNull Uri saveCollection

The URL of the table to insert into.

@NonNull ContentValues contentValues

to be included in the created image file.

Public methods

setMetadata

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

Sets the metadata to be stored with the saved image.

For JPEG this will be included in the EXIF.

Parameters
@NonNull ImageCapture.Metadata metadata

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