# ScreenCapture

Summary:[Methods](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture#)  

# ScreenCapture

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public

final

class
ScreenCapture
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object.html)`


``


`

|---|------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||
| ↳ | android.support.test.runner.screenshot.ScreenCapture |

<br />

*** ** * ** ***

A ScreenCapture contains a bitmap of a device screen along with a set of[ScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCaptureProcessor)s that will be used to process the[ScreenCapture](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture)when[process()](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture#process())is called.

If no[ScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCaptureProcessor)s are added to the list the[BasicScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/BasicScreenCaptureProcessor)is used when[process()](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture#process())is called.

If a set of processors are supplied with the call to[process()](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture#process())then those processors will take precedence over the set of global processors and the[BasicScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/BasicScreenCaptureProcessor).

**This API is currently in beta.**

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ||
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` boolean`                                                                                                       | ` `[equals](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object.html)` obj) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` `[Bitmap](https://developer.android.com/reference/android/graphics/Bitmap.html)                                | ` `[getBitmap](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture#getBitmap())`() ` Returns the[Bitmap](https://developer.android.com/reference/android/graphics/Bitmap.html)that was set when the[ScreenCapture](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture)was created.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` `[Bitmap.CompressFormat](https://developer.android.com/reference/android/graphics/Bitmap.CompressFormat.html)  | ` `[getFormat](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture#getFormat())`() ` Returns the format to save the bitmap as or PNG if none has been set.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` `[String](https://developer.android.com/reference/java/lang/String.html)                                       | ` `[getName](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture#getName())`() ` Returns the filename to save the bitmap as or null if none has been set.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ` int`                                                                                                           | ` `[hashCode](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture#hashCode())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` void`                                                                                                          | ` `[process](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture#process(java.util.Set<android.support.test.runner.screenshot.ScreenCaptureProcessor>))`(`[Set](https://developer.android.com/reference/java/util/Set.html)`<`[ScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCaptureProcessor)`> processorSet) ` Process the[ScreenCapture](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture)using the given set of[ScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCaptureProcessor)s or the[BasicScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/BasicScreenCaptureProcessor)if no processors are in the given set. |
| ` void`                                                                                                          | ` `[process](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture#process())`() ` Process the[ScreenCapture](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture)using the global set of[ScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCaptureProcessor)s or the[BasicScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/BasicScreenCaptureProcessor)if no processors are set.                                                                                                                                                                                                                                                                                                            |
| ` `[ScreenCapture](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture) | ` `[setFormat](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture#setFormat(android.graphics.Bitmap.CompressFormat))`(`[Bitmap.CompressFormat](https://developer.android.com/reference/android/graphics/Bitmap.CompressFormat.html)` format) ` Sets the format to save the[ScreenCapture](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture)as.                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` `[ScreenCapture](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture) | ` `[setName](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture#setName(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` filename) ` Sets the filename to save the[ScreenCapture](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture)as.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture#)From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object.html)` ` |-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object.html)          | ` clone() `                                                                                | | ` boolean`                                                                          | ` equals(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` void`                                                                             | ` finalize() `                                                                             | | ` final `[Class](https://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                             | | ` int`                                                                              | ` hashCode() `                                                                             | | ` final void`                                                                       | ` notify() `                                                                               | | ` final void`                                                                       | ` notifyAll() `                                                                            | | ` `[String](https://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                             | | ` final void`                                                                       | ` wait(long arg0, int arg1) `                                                              | | ` final void`                                                                       | ` wait(long arg0) `                                                                        | | ` final void`                                                                       | ` wait() `                                                                                 | ||

## Public methods

### equals

```
boolean equals (Object obj)
```

<br />

<br />

|       Parameters       ||
|-------|-----------------|
| `obj` | `Object` <br /> |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### getBitmap

```
Bitmap getBitmap ()
```

Returns the[Bitmap](https://developer.android.com/reference/android/graphics/Bitmap.html)that was set when the[ScreenCapture](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture)was created.

<br />

|                                        Returns                                         ||
|--------------------------------------------------------------------------------|--------|
| [Bitmap](https://developer.android.com/reference/android/graphics/Bitmap.html) | <br /> |

### getFormat

```
Bitmap.CompressFormat getFormat ()
```

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

<br />

|                                                       Returns                                                        ||
|--------------------------------------------------------------------------------------------------------------|--------|
| [Bitmap.CompressFormat](https://developer.android.com/reference/android/graphics/Bitmap.CompressFormat.html) | <br /> |

### getName

```
String getName ()
```

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

<br />

|                                     Returns                                     ||
|-------------------------------------------------------------------------|--------|
| [String](https://developer.android.com/reference/java/lang/String.html) | <br /> |

### hashCode

```
int hashCode ()
```

<br />

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### process

```
void process (Set<ScreenCaptureProcessor> processorSet)
```

Process the[ScreenCapture](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture)using the given set of[ScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCaptureProcessor)s or the[BasicScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/BasicScreenCaptureProcessor)if no processors are in the given set.

<br />

|                                       Parameters                                        ||
|----------------|-------------------------------------------------------------------------|
| `processorSet` | `Set`: the set of processors to use to process the ScreenCapture <br /> |

|                                                                                  Throws                                                                                  ||
|---------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException.html) | if there is an IOException while any of the processors are processing the ScreenCapture |

### process

```
void process ()
```

Process the[ScreenCapture](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture)using the global set of[ScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCaptureProcessor)s or the[BasicScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/BasicScreenCaptureProcessor)if no processors are set.

<br />

|                                                                                  Throws                                                                                  ||
|---------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException.html) | 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](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture)as.

<br />

|                                      Parameters                                       ||
|----------|-----------------------------------------------------------------------------|
| `format` | `Bitmap.CompressFormat`: the format to use to save the screenshot as <br /> |

|                                                                 Returns                                                                  ||
|---------------------------------------------------------------------------------------------------------------|---------------------------|
| [ScreenCapture](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture) | a fluent interface <br /> |

### setName

```
ScreenCapture setName (String filename)
```

Sets the filename to save the[ScreenCapture](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture)as.

<br />

|                               Parameters                                ||
|------------|-------------------------------------------------------------|
| `filename` | `String`: the filename to use to save the capture as <br /> |

|                                                                 Returns                                                                  ||
|---------------------------------------------------------------------------------------------------------------|---------------------------|
| [ScreenCapture](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture) | a fluent interface <br /> |

-

  ## Interfaces

  - [ScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCaptureProcessor)
-

  ## Classes

  - [BasicScreenCaptureProcessor](https://developer.android.com/reference/android/support/test/runner/screenshot/BasicScreenCaptureProcessor)
  - [ScreenCapture](https://developer.android.com/reference/android/support/test/runner/screenshot/ScreenCapture)
  - [Screenshot](https://developer.android.com/reference/android/support/test/runner/screenshot/Screenshot)
  - [UiAutomationWrapper](https://developer.android.com/reference/android/support/test/runner/screenshot/UiAutomationWrapper)