Stay organized with collections
Save and categorize content based on your preferences.
ScreenshotResult
class ScreenshotResult
Can be used to construct a bitmap of the screenshot or any other operations for AccessibilityService.takeScreenshot
API.
Summary
Public methods
getColorSpace
fun getColorSpace(): ColorSpace
Gets the ColorSpace
identifying a specific organization of colors of the screenshot.
Return |
ColorSpace |
the color space This value cannot be null . |
getHardwareBuffer
fun getHardwareBuffer(): HardwareBuffer
Gets the HardwareBuffer
representing a memory buffer of the screenshot.
Note: The application should call HardwareBuffer.close()
when the buffer is no longer needed to free the underlying resources.
getTimestamp
fun getTimestamp(): Long
Gets the timestamp of taking the screenshot.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# AccessibilityService.ScreenshotResult\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nScreenshotResult\n================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/accessibilityservice/AccessibilityService.ScreenshotResult \"View this page in Java\") \n\n```\nclass ScreenshotResult\n```\n\n|---|-------------------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.accessibilityservice.AccessibilityService.ScreenshotResult](#) |\n\nCan be used to construct a bitmap of the screenshot or any other operations for [AccessibilityService.takeScreenshot](/reference/kotlin/android/accessibilityservice/AccessibilityService#takeScreenshot(kotlin.Int,%20java.util.concurrent.Executor,%20android.accessibilityservice.AccessibilityService.TakeScreenshotCallback)) API.\n\nSummary\n-------\n\n| Public methods ||\n|------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [ColorSpace](../graphics/ColorSpace.html#) | [getColorSpace](#getColorSpace())`()` Gets the [ColorSpace](../graphics/ColorSpace.html#) identifying a specific organization of colors of the screenshot. |\n| [HardwareBuffer](../hardware/HardwareBuffer.html#) | [getHardwareBuffer](#getHardwareBuffer())`()` Gets the [HardwareBuffer](../hardware/HardwareBuffer.html#) representing a memory buffer of the screenshot. |\n| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | [getTimestamp](#getTimestamp())`()` Gets the timestamp of taking the screenshot. |\n\nPublic methods\n--------------\n\n### getColorSpace\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getColorSpace(): ColorSpace\n```\n\nGets the [ColorSpace](../graphics/ColorSpace.html#) identifying a specific organization of colors of the screenshot.\n\n| Return ||\n|--------------------------------------------|----------------------------------------------|\n| [ColorSpace](../graphics/ColorSpace.html#) | the color space This value cannot be `null`. |\n\n### getHardwareBuffer\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getHardwareBuffer(): HardwareBuffer\n```\n\nGets the [HardwareBuffer](../hardware/HardwareBuffer.html#) representing a memory buffer of the screenshot.\n\n**Note:** The application should call [HardwareBuffer.close()](../hardware/HardwareBuffer.html#close()) when the buffer is no longer needed to free the underlying resources.\n\n| Return ||\n|----------------------------------------------------|--------------------------------------------------|\n| [HardwareBuffer](../hardware/HardwareBuffer.html#) | the hardware buffer This value cannot be `null`. |\n\n### getTimestamp\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getTimestamp(): Long\n```\n\nGets the timestamp of taking the screenshot.\n\n| Return ||\n|------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| [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()](../os/SystemClock.html#uptimeMillis()) |"]]