# AccessibilityService.ScreenshotResult

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# ScreenshotResult

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.ScreenshotResult "View this page in Java")  

```
class ScreenshotResult
```

|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                                           ||
| ↳ | [android.accessibilityservice.AccessibilityService.ScreenshotResult](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.ScreenshotResult#) |

Can be used to construct a bitmap of the screenshot or any other operations for[AccessibilityService.takeScreenshot](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService#takeScreenshot(kotlin.Int,%20java.util.concurrent.Executor,%20android.accessibilityservice.AccessibilityService.TakeScreenshotCallback))API.

## Summary

|                                                                                                                                                                                                            Public methods                                                                                                                                                                                                             ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.html#)         | [getColorSpace](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.ScreenshotResult#getColorSpace())`()` Gets the[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.html#)identifying a specific organization of colors of the screenshot. |
| [HardwareBuffer](https://developer.android.com/reference/kotlin/android/hardware/HardwareBuffer.html#) | [getHardwareBuffer](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.ScreenshotResult#getHardwareBuffer())`()` Gets the[HardwareBuffer](https://developer.android.com/reference/kotlin/android/hardware/HardwareBuffer.html#)representing a memory buffer of the screenshot.  |
| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)                           | [getTimestamp](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.ScreenshotResult#getTimestamp())`()` Gets the timestamp of taking the screenshot.                                                                                                                             |

## Public methods

### getColorSpace

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getColorSpace(): ColorSpace
```

Gets the[ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.html#)identifying a specific organization of colors of the screenshot.

|                                                                   Return                                                                    ||
|------------------------------------------------------------------------------------------------|---------------------------------------------|
| [ColorSpace](https://developer.android.com/reference/kotlin/android/graphics/ColorSpace.html#) | the color space This value cannot be`null`. |

### getHardwareBuffer

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getHardwareBuffer(): HardwareBuffer
```

Gets the[HardwareBuffer](https://developer.android.com/reference/kotlin/android/hardware/HardwareBuffer.html#)representing a memory buffer of the screenshot.

**Note:** The application should call[HardwareBuffer.close()](https://developer.android.com/reference/kotlin/android/hardware/HardwareBuffer.html#close())when the buffer is no longer needed to free the underlying resources.

|                                                                         Return                                                                          ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------|
| [HardwareBuffer](https://developer.android.com/reference/kotlin/android/hardware/HardwareBuffer.html#) | the hardware buffer This value cannot be`null`. |

### getTimestamp

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getTimestamp(): Long
```

Gets the timestamp of taking the screenshot.

|                                                                                                                                      Return                                                                                                                                      ||
|------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | milliseconds of non-sleep uptime before screenshot since boot and it's from[SystemClock.uptimeMillis()](https://developer.android.com/reference/kotlin/android/os/SystemClock.html#uptimeMillis()) |