Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.

ScreenCapture

public final class ScreenCapture
extends Object

java.lang.Object
   ↳ android.support.test.runner.screenshot.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 process() 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 methods

boolean equals(Object obj)
Bitmap getBitmap()

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

Bitmap.CompressFormat getFormat()

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

String getName()

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

int hashCode()
void process(Set<ScreenCaptureProcessor> processorSet)

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

void process()

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

ScreenCapture setFormat(Bitmap.CompressFormat format)

Sets the format to save the ScreenCapture as.

ScreenCapture setName(String filename)

Sets the filename to save the ScreenCapture as.

Inherited methods

From class java.lang.Object

Public methods

equals

boolean equals (Object obj)

Parameters
obj Object

Returns
boolean

getBitmap

Bitmap getBitmap ()

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

Returns
Bitmap

getFormat

Bitmap.CompressFormat getFormat ()

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

Returns
Bitmap.CompressFormat

getName

String getName ()

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

Returns
String

hashCode

int hashCode ()

Returns
int

process

void process (Set<ScreenCaptureProcessor> processorSet)

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

Parameters
processorSet Set: the set of processors to use to process the ScreenCapture

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

process

void process ()

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

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

setFormat

ScreenCapture setFormat (Bitmap.CompressFormat format)

Sets the format to save the ScreenCapture as.

Parameters
format Bitmap.CompressFormat: the format to use to save the screenshot as

Returns
ScreenCapture a fluent interface

setName

ScreenCapture setName (String filename)

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