Stay organized with collections
Save and categorize content based on your preferences.
TextureView.SurfaceTextureListener
public
static
interface
TextureView.SurfaceTextureListener
android.view.TextureView.SurfaceTextureListener
|
This listener can be used to be notified when the surface texture
associated with this texture view is available.
Summary
Public methods
onSurfaceTextureAvailable
public abstract void onSurfaceTextureAvailable (SurfaceTexture surface,
int width,
int height)
Invoked when a TextureView
's SurfaceTexture is ready for use.
Parameters |
surface |
SurfaceTexture : The surface returned by
TextureView.getSurfaceTexture()
This value cannot be null . |
width |
int : The width of the surface |
height |
int : The height of the surface |
onSurfaceTextureDestroyed
public abstract boolean onSurfaceTextureDestroyed (SurfaceTexture surface)
Invoked when the specified SurfaceTexture
is about to be destroyed.
If returns true, no rendering should happen inside the surface texture after this method
is invoked. If returns false, the client needs to call SurfaceTexture.release()
.
Most applications should return true.
Parameters |
surface |
SurfaceTexture : The surface about to be destroyed
This value cannot be null . |
onSurfaceTextureSizeChanged
public abstract void onSurfaceTextureSizeChanged (SurfaceTexture surface,
int width,
int height)
Invoked when the SurfaceTexture
's buffers size changed.
Parameters |
surface |
SurfaceTexture : The surface returned by
TextureView.getSurfaceTexture()
This value cannot be null . |
width |
int : The new width of the surface |
height |
int : The new height of the surface |
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.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# TextureView.SurfaceTextureListener\n\nAdded in [API level 14](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nTextureView.SurfaceTextureListener\n==================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/view/TextureView.SurfaceTextureListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nTextureView.SurfaceTextureListener\n`\n\n\n`\n\n\n`\n\n|-------------------------------------------------|\n| android.view.TextureView.SurfaceTextureListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nThis listener can be used to be notified when the surface texture\nassociated with this texture view is available.\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onSurfaceTextureAvailable](/reference/android/view/TextureView.SurfaceTextureListener#onSurfaceTextureAvailable(android.graphics.SurfaceTexture,%20int,%20int))`(`[SurfaceTexture](/reference/android/graphics/SurfaceTexture)` surface, int width, int height) ` Invoked when a [TextureView](/reference/android/view/TextureView)'s SurfaceTexture is ready for use. |\n| ` abstract boolean` | ` `[onSurfaceTextureDestroyed](/reference/android/view/TextureView.SurfaceTextureListener#onSurfaceTextureDestroyed(android.graphics.SurfaceTexture))`(`[SurfaceTexture](/reference/android/graphics/SurfaceTexture)` surface) ` Invoked when the specified [SurfaceTexture](/reference/android/graphics/SurfaceTexture) is about to be destroyed. |\n| ` abstract void` | ` `[onSurfaceTextureSizeChanged](/reference/android/view/TextureView.SurfaceTextureListener#onSurfaceTextureSizeChanged(android.graphics.SurfaceTexture,%20int,%20int))`(`[SurfaceTexture](/reference/android/graphics/SurfaceTexture)` surface, int width, int height) ` Invoked when the [SurfaceTexture](/reference/android/graphics/SurfaceTexture)'s buffers size changed. |\n| ` abstract void` | ` `[onSurfaceTextureUpdated](/reference/android/view/TextureView.SurfaceTextureListener#onSurfaceTextureUpdated(android.graphics.SurfaceTexture))`(`[SurfaceTexture](/reference/android/graphics/SurfaceTexture)` surface) ` Invoked when the specified [SurfaceTexture](/reference/android/graphics/SurfaceTexture) is updated through [SurfaceTexture.updateTexImage()](/reference/android/graphics/SurfaceTexture#updateTexImage()). |\n\nPublic methods\n--------------\n\n### onSurfaceTextureAvailable\n\nAdded in [API level 14](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onSurfaceTextureAvailable (SurfaceTexture surface, \n int width, \n int height)\n```\n\nInvoked when a [TextureView](/reference/android/view/TextureView)'s SurfaceTexture is ready for use.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `surface` | `SurfaceTexture`: The surface returned by [TextureView.getSurfaceTexture()](/reference/android/view/TextureView#getSurfaceTexture()) This value cannot be `null`. \u003cbr /\u003e |\n| `width` | `int`: The width of the surface \u003cbr /\u003e |\n| `height` | `int`: The height of the surface \u003cbr /\u003e |\n\n### onSurfaceTextureDestroyed\n\nAdded in [API level 14](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean onSurfaceTextureDestroyed (SurfaceTexture surface)\n```\n\nInvoked when the specified [SurfaceTexture](/reference/android/graphics/SurfaceTexture) is about to be destroyed.\nIf returns true, no rendering should happen inside the surface texture after this method\nis invoked. If returns false, the client needs to call [SurfaceTexture.release()](/reference/android/graphics/SurfaceTexture#release()).\nMost applications should return true.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------|-----------------------------------------------------------------------------------------|\n| `surface` | `SurfaceTexture`: The surface about to be destroyed This value cannot be `null`. \u003cbr /\u003e |\n\n| Returns ||\n|-----------|--------|\n| `boolean` | \u003cbr /\u003e |\n\n### onSurfaceTextureSizeChanged\n\nAdded in [API level 14](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onSurfaceTextureSizeChanged (SurfaceTexture surface, \n int width, \n int height)\n```\n\nInvoked when the [SurfaceTexture](/reference/android/graphics/SurfaceTexture)'s buffers size changed.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `surface` | `SurfaceTexture`: The surface returned by [TextureView.getSurfaceTexture()](/reference/android/view/TextureView#getSurfaceTexture()) This value cannot be `null`. \u003cbr /\u003e |\n| `width` | `int`: The new width of the surface \u003cbr /\u003e |\n| `height` | `int`: The new height of the surface \u003cbr /\u003e |\n\n### onSurfaceTextureUpdated\n\nAdded in [API level 14](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onSurfaceTextureUpdated (SurfaceTexture surface)\n```\n\nInvoked when the specified [SurfaceTexture](/reference/android/graphics/SurfaceTexture) is updated through\n[SurfaceTexture.updateTexImage()](/reference/android/graphics/SurfaceTexture#updateTexImage()).\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------|--------------------------------------------------------------------------------|\n| `surface` | `SurfaceTexture`: The surface just updated This value cannot be `null`. \u003cbr /\u003e |"]]