{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

ScreenCapture

class ScreenCapture


A ScreenCapture contains a bitmap of a device screen along with a set of ScreenCaptureProcessors that will be used to process the ScreenCapture when is called.

If no ScreenCaptureProcessors are added to the list the BasicScreenCaptureProcessor is used when process is called.

If a set of processors are supplied with the call to process then those processors will take precedence over the set of global processors and the BasicScreenCaptureProcessor.

This API is currently in beta.

Summary

Public functions

Boolean
equals(obj: Any)
Bitmap

Returns the Bitmap that was set when the ScreenCapture was created.

CompressFormat

Returns the format to save the bitmap as or PNG if none has been set.

String

Returns the filename to save the bitmap as or null if none has been set.

Int
Unit

Process the ScreenCapture using the global set of ScreenCaptureProcessors or the BasicScreenCaptureProcessor if no processors are set.

Unit

Process the ScreenCapture using the given set of ScreenCaptureProcessors or the BasicScreenCaptureProcessor if no processors are in the given set.

ScreenCapture
setFormat(format: CompressFormat)

Sets the format to save the ScreenCapture as.

ScreenCapture
setName(filename: String)

Sets the filename to save the ScreenCapture as.

Public functions

equals

fun equals(obj: Any): Boolean

getBitmap

fun getBitmap(): Bitmap

Returns the Bitmap that was set when the ScreenCapture was created.

getFormat

fun getFormat(): CompressFormat

Returns the format to save the bitmap as or PNG if none has been set.

getName

fun getName(): String

Returns the filename to save the bitmap as or null if none has been set.

hashCode

fun hashCode(): Int

process

fun process(): Unit

Process the ScreenCapture using the global set of ScreenCaptureProcessors or the BasicScreenCaptureProcessor if no processors are set.

Throws
java.io.IOException

if there is an IOException while any of the processors are processing the ScreenCapture

process

fun process(processorSet: Set<ScreenCaptureProcessor>): Unit

Process the ScreenCapture using the given set of ScreenCaptureProcessors or the BasicScreenCaptureProcessor if no processors are in the given set.

Parameters
processorSet: Set<ScreenCaptureProcessor>

the set of processors to use to process the ScreenCapture

Throws
java.io.IOException

if there is an IOException while any of the processors are processing the ScreenCapture

setFormat

fun setFormat(format: CompressFormat): ScreenCapture

Sets the format to save the ScreenCapture as.

Parameters
format: CompressFormat

the format to use to save the screenshot as

Returns
ScreenCapture

a fluent interface

setName

fun setName(filename: String): ScreenCapture

Sets the filename to save the ScreenCapture as.

Parameters
filename: String

the filename to use to save the capture as

Returns
ScreenCapture

a fluent interface