Stay organized with collections
Save and categorize content based on your preferences.
open class ScrollCaptureSession
A session represents the scope of interaction between a ScrollCaptureCallback
and the system during an active scroll capture operation.
Summary
Public constructors |
Constructs a new session instance.
|
Public constructors
ScrollCaptureSession(
surface: Surface,
scrollBounds: Rect,
positionInWindow: Point)
Constructs a new session instance.
Parameters |
surface |
Surface: the surface to consume generated images This value cannot be null . |
scrollBounds |
Rect: the bounds of the capture area within the containing view This value cannot be null . |
positionInWindow |
Point: the offset of scrollBounds within the window This value cannot be null . |
Public methods
getPositionInWindow
open fun getPositionInWindow(): Point
Returns the offset of scroll bounds
within the window.
Return |
Point |
the area of scrolling content within the containing view This value cannot be null . |
getSurface
open fun getSurface(): Surface
Returns a BufferQueue in the form of a Surface
for transfer of image buffers.
The surface is guaranteed to remain valid
until the session ends
.
Return |
Surface |
the surface for transferring image buffers This value cannot be null . |
Exceptions |
java.lang.IllegalStateException |
if the session has been closed |
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,["# ScrollCaptureSession\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nScrollCaptureSession\n====================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/view/ScrollCaptureSession \"View this page in Java\") \n\n```\nopen class ScrollCaptureSession\n```\n\n|---|----------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.view.ScrollCaptureSession](#) |\n\nA session represents the scope of interaction between a [ScrollCaptureCallback](/reference/kotlin/android/view/ScrollCaptureCallback) and the system during an active scroll capture operation.\n\nSummary\n-------\n\n| Public constructors ||\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [ScrollCaptureSession](#ScrollCaptureSession(android.view.Surface,%20android.graphics.Rect,%20android.graphics.Point))`(`surface:` `[Surface](/reference/kotlin/android/view/Surface)`, `scrollBounds:` `[Rect](../graphics/Rect.html#)`, `positionInWindow:` `[Point](../graphics/Point.html#)`)` Constructs a new session instance. |\n\n| Public methods ||\n|--------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Point](../graphics/Point.html#) | [getPositionInWindow](#getPositionInWindow())`()` Returns the offset of `scroll bounds` within the window. |\n| open [Rect](../graphics/Rect.html#) | [getScrollBounds](#getScrollBounds())`()` Returns the `scroll bounds`, as provided by [ScrollCaptureCallback.onScrollCaptureSearch](/reference/kotlin/android/view/ScrollCaptureCallback#onScrollCaptureSearch(android.os.CancellationSignal,%20java.util.function.Consumer)). |\n| open [Surface](/reference/kotlin/android/view/Surface) | [getSurface](#getSurface())`()` Returns a [BufferQueue](https://source.android.com/devices/graphics/arch-bq-gralloc) in the form of a [Surface](/reference/kotlin/android/view/Surface) for transfer of image buffers. |\n\nPublic constructors\n-------------------\n\n### ScrollCaptureSession\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nScrollCaptureSession(\n surface: Surface, \n scrollBounds: Rect, \n positionInWindow: Point)\n```\n\nConstructs a new session instance.\n\n| Parameters ||\n|--------------------|-------------------------------------------------------------------------------------------------------------------------|\n| `surface` | [Surface](/reference/kotlin/android/view/Surface): the surface to consume generated images This value cannot be `null`. |\n| `scrollBounds` | [Rect](../graphics/Rect.html#): the bounds of the capture area within the containing view This value cannot be `null`. |\n| `positionInWindow` | [Point](../graphics/Point.html#): the offset of scrollBounds within the window This value cannot be `null`. |\n\nPublic methods\n--------------\n\n### getPositionInWindow\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getPositionInWindow(): Point\n```\n\nReturns the offset of `scroll bounds` within the window.\n\n| Return ||\n|----------------------------------|---------------------------------------------------------------------------------------|\n| [Point](../graphics/Point.html#) | the area of scrolling content within the containing view This value cannot be `null`. |\n\n### getScrollBounds\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getScrollBounds(): Rect\n```\n\nReturns the `scroll bounds`, as provided by [ScrollCaptureCallback.onScrollCaptureSearch](/reference/kotlin/android/view/ScrollCaptureCallback#onScrollCaptureSearch(android.os.CancellationSignal,%20java.util.function.Consumer)).\n\n| Return ||\n|--------------------------------|---------------------------------------------------------------------------------------|\n| [Rect](../graphics/Rect.html#) | the area of scrolling content within the containing view This value cannot be `null`. |\n\n### getSurface\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getSurface(): Surface\n```\n\nReturns a [BufferQueue](https://source.android.com/devices/graphics/arch-bq-gralloc) in the form of a [Surface](/reference/kotlin/android/view/Surface) for transfer of image buffers.\n\nThe surface is guaranteed to remain [valid](/reference/kotlin/android/view/Surface#isValid()) until the session [ends](/reference/kotlin/android/view/ScrollCaptureCallback#onScrollCaptureEnd(java.lang.Runnable)).\n\n| Return ||\n|---------------------------------------------------|-------------------------------------------------------------------------|\n| [Surface](/reference/kotlin/android/view/Surface) | the surface for transferring image buffers This value cannot be `null`. |\n\n| Exceptions ||\n|-----------------------------------|--------------------------------|\n| `java.lang.IllegalStateException` | if the session has been closed |"]]