Stay organized with collections
Save and categorize content based on your preferences.
TakeScreenshotCallback
interface TakeScreenshotCallback
Interface used to report status of taking screenshot.
Summary
Public methods |
abstract Unit |
Called when taking screenshot has failed.
|
abstract Unit |
Called when taking screenshot has completed successfully.
|
Public methods
onFailure
abstract fun onFailure(errorCode: Int): Unit
Called when taking screenshot has failed. errorCode
will identify the reason of failure.
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.TakeScreenshotCallback\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nTakeScreenshotCallback\n======================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/accessibilityservice/AccessibilityService.TakeScreenshotCallback \"View this page in Java\") \n\n```\ninterface TakeScreenshotCallback\n```\n\n|-------------------------------------------------------------------------------|\n| [android.accessibilityservice.AccessibilityService.TakeScreenshotCallback](#) |\n\nInterface used to report status of taking screenshot.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onFailure](#onFailure(kotlin.Int))`(`errorCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called when taking screenshot has failed. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onSuccess](#onSuccess(android.accessibilityservice.AccessibilityService.ScreenshotResult))`(`screenshot:` `[AccessibilityService.ScreenshotResult](/reference/kotlin/android/accessibilityservice/AccessibilityService.ScreenshotResult)`)` Called when taking screenshot has completed successfully. |\n\nPublic methods\n--------------\n\n### onFailure\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onFailure(errorCode: Int): Unit\n```\n\nCalled when taking screenshot has failed. `errorCode` will identify the reason of failure.\n\n| Parameters ||\n|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `errorCode` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The error code of this operation. Value is [android.accessibilityservice.AccessibilityService#ERROR_TAKE_SCREENSHOT_INTERNAL_ERROR](/reference/kotlin/android/accessibilityservice/AccessibilityService#ERROR_TAKE_SCREENSHOT_INTERNAL_ERROR:kotlin.Int), [android.accessibilityservice.AccessibilityService#ERROR_TAKE_SCREENSHOT_NO_ACCESSIBILITY_ACCESS](/reference/kotlin/android/accessibilityservice/AccessibilityService#ERROR_TAKE_SCREENSHOT_NO_ACCESSIBILITY_ACCESS:kotlin.Int), [android.accessibilityservice.AccessibilityService#ERROR_TAKE_SCREENSHOT_INTERVAL_TIME_SHORT](/reference/kotlin/android/accessibilityservice/AccessibilityService#ERROR_TAKE_SCREENSHOT_INTERVAL_TIME_SHORT:kotlin.Int), [android.accessibilityservice.AccessibilityService#ERROR_TAKE_SCREENSHOT_INVALID_DISPLAY](/reference/kotlin/android/accessibilityservice/AccessibilityService#ERROR_TAKE_SCREENSHOT_INVALID_DISPLAY:kotlin.Int), or [android.accessibilityservice.AccessibilityService#ERROR_TAKE_SCREENSHOT_INVALID_WINDOW](/reference/kotlin/android/accessibilityservice/AccessibilityService#ERROR_TAKE_SCREENSHOT_INVALID_WINDOW:kotlin.Int) |\n\n### onSuccess\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onSuccess(screenshot: AccessibilityService.ScreenshotResult): Unit\n```\n\nCalled when taking screenshot has completed successfully.\n\n| Parameters ||\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `screenshot` | [AccessibilityService.ScreenshotResult](/reference/kotlin/android/accessibilityservice/AccessibilityService.ScreenshotResult): The content of screenshot. This value cannot be `null`. |"]]