# ScreenCapture

Artifact: [androidx.test:runner](https://developer.android.com/jetpack/androidx/releases/test) [View Source](https://cs.android.com/search?q=file:androidx/test/runner/screenshot/ScreenCapture.java+class:androidx.test.runner.screenshot.ScreenCapture)

*** ** * ** ***


```
public final class ScreenCapture
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
>
> use androidx.test.espresso.screenshot.captureToBitmap or androidx.test.core.app.DeviceCapture instead

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

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

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

## Summary

| ### Public fields |
|---|---|
| `final https://developer.android.com/reference/android/graphics/Bitmap.html` | `https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#bitmap()` **This field is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/android/graphics/Bitmap.CompressFormat.html` | `https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#format()` **This field is deprecated.** Deprecated in Java |

| ### Public methods |
|---|---|
| `boolean` | `[equals](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#equals(java.lang.Object))(https://developer.android.com/reference/java/lang/Object.html obj)` **This method is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/android/graphics/Bitmap.html` | `[getBitmap](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#getBitmap())()` **This method is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/android/graphics/Bitmap.CompressFormat.html` | `[getFormat](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#getFormat())()` **This method is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/java/lang/String.html` | `[getName](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#getName())()` **This method is deprecated.** Deprecated in Java |
| `int` | `[hashCode](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#hashCode())()` **This method is deprecated.** Deprecated in Java |
| `void` | `[process](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#process())()` **This method is deprecated.** Deprecated in Java |
| `void` | `[process](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#process(java.util.Set<androidx.test.runner.screenshot.ScreenCaptureProcessor>))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCaptureProcessor> processorSet)` **This method is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture` | `[setFormat](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#setFormat(android.graphics.Bitmap.CompressFormat))(https://developer.android.com/reference/android/graphics/Bitmap.CompressFormat.html format)` **This method is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture` | `[setName](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#setName(java.lang.String))(https://developer.android.com/reference/java/lang/String.html filename)` **This method is deprecated.** Deprecated in Java |

## Public fields

### bitmap

```
public final Bitmap bitmap
```

> [!CAUTION]
> **This field is deprecated.**   
> Deprecated in Java

### format

```
public Bitmap.CompressFormat format
```

> [!CAUTION]
> **This field is deprecated.**   
> Deprecated in Java

## Public methods

### equals

```
public boolean [equals](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#equals(java.lang.Object))(Object obj)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

### getBitmap

```
public Bitmap [getBitmap](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#getBitmap())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Returns the `https://developer.android.com/reference/android/graphics/Bitmap.html` that was set when the `https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture` was created.

### getFormat

```
public Bitmap.CompressFormat [getFormat](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#getFormat())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

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

### getName

```
public String [getName](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#getName())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

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

### hashCode

```
public int [hashCode](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#hashCode())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

### process

```
public void [process](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#process())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Process the `https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture` using the global set of `https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCaptureProcessor`s or the `https://developer.android.com/reference/androidx/test/runner/screenshot/BasicScreenCaptureProcessor` if no processors are set.

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

### process

```
public void [process](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#process(java.util.Set<androidx.test.runner.screenshot.ScreenCaptureProcessor>))(@NonNull Set<ScreenCaptureProcessor> processorSet)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Process the `https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture` using the given set of `https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCaptureProcessor`s or the `https://developer.android.com/reference/androidx/test/runner/screenshot/BasicScreenCaptureProcessor` if no processors are in the given set.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCaptureProcessor> processorSet` | the set of processors to use to process the ScreenCapture |

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

### setFormat

```
public ScreenCapture [setFormat](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#setFormat(android.graphics.Bitmap.CompressFormat))(Bitmap.CompressFormat format)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the format to save the `https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture` as.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/graphics/Bitmap.CompressFormat.html format` | the format to use to save the screenshot as |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture` | a fluent interface |

### setName

```
public ScreenCapture [setName](https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture#setName(java.lang.String))(String filename)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the filename to save the `https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture` as.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html filename` | the filename to use to save the capture as |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/test/runner/screenshot/ScreenCapture` | a fluent interface |