Added in API level 14

SurfaceTextureListener


interface 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
abstract Unit
onSurfaceTextureAvailable(surface: SurfaceTexture, width: Int, height: Int)

Invoked when a TextureView's SurfaceTexture is ready for use.

abstract Boolean

Invoked when the specified SurfaceTexture is about to be destroyed.

abstract Unit
onSurfaceTextureSizeChanged(surface: SurfaceTexture, width: Int, height: Int)

Invoked when the SurfaceTexture's buffers size changed.

abstract Unit

Invoked when the specified SurfaceTexture is updated through SurfaceTexture.updateTexImage().

Public methods

onSurfaceTextureAvailable

Added in API level 14
abstract fun onSurfaceTextureAvailable(
    surface: SurfaceTexture,
    width: Int,
    height: Int
): Unit

Invoked when a TextureView's SurfaceTexture is ready for use.

Parameters
surface SurfaceTexture: The surface returned by android.view.TextureView#getSurfaceTexture() This value cannot be null.
width Int: The width of the surface
height Int: The height of the surface

onSurfaceTextureDestroyed

Added in API level 14
abstract fun onSurfaceTextureDestroyed(surface: SurfaceTexture): Boolean

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

Added in API level 14
abstract fun onSurfaceTextureSizeChanged(
    surface: SurfaceTexture,
    width: Int,
    height: Int
): Unit

Invoked when the SurfaceTexture's buffers size changed.

Parameters
surface SurfaceTexture: The surface returned by android.view.TextureView#getSurfaceTexture() This value cannot be null.
width Int: The new width of the surface
height Int: The new height of the surface

onSurfaceTextureUpdated

Added in API level 14
abstract fun onSurfaceTextureUpdated(surface: SurfaceTexture): Unit

Invoked when the specified SurfaceTexture is updated through SurfaceTexture.updateTexImage().

Parameters
surface SurfaceTexture: The surface just updated This value cannot be null.