Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

# TextureView.SurfaceTextureListener

*** ** * ** ***

` public static interface TextureView.SurfaceTextureListener `   
` `

|---|
| android.view.TextureView.SurfaceTextureListener |

<br />

*** ** * ** ***

This listener can be used to be notified when the surface texture associated with this texture view is available.

## Summary

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/view/TextureView.SurfaceTextureListener#onSurfaceTextureAvailable(android.graphics.SurfaceTexture,%20int,%20int)(https://developer.android.com/reference/android/graphics/SurfaceTexture surface, int width, int height) ` Invoked when a `https://developer.android.com/reference/android/view/TextureView`'s SurfaceTexture is ready for use. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/TextureView.SurfaceTextureListener#onSurfaceTextureDestroyed(android.graphics.SurfaceTexture)(https://developer.android.com/reference/android/graphics/SurfaceTexture surface) ` Invoked when the specified `https://developer.android.com/reference/android/graphics/SurfaceTexture` is about to be destroyed. |
| ` abstract void` | ` https://developer.android.com/reference/android/view/TextureView.SurfaceTextureListener#onSurfaceTextureSizeChanged(android.graphics.SurfaceTexture,%20int,%20int)(https://developer.android.com/reference/android/graphics/SurfaceTexture surface, int width, int height) ` Invoked when the `https://developer.android.com/reference/android/graphics/SurfaceTexture`'s buffers size changed. |
| ` abstract void` | ` https://developer.android.com/reference/android/view/TextureView.SurfaceTextureListener#onSurfaceTextureUpdated(android.graphics.SurfaceTexture)(https://developer.android.com/reference/android/graphics/SurfaceTexture surface) ` Invoked when the specified `https://developer.android.com/reference/android/graphics/SurfaceTexture` is updated through `https://developer.android.com/reference/android/graphics/SurfaceTexture#updateTexImage()`. |

## Public methods

### onSurfaceTextureAvailable

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onSurfaceTextureAvailable (SurfaceTexture surface, 
                int width, 
                int height)
```

Invoked when a `https://developer.android.com/reference/android/view/TextureView`'s SurfaceTexture is ready for use.

<br />

| Parameters ||
|---|---|
| `surface` | `SurfaceTexture`: The surface returned by `https://developer.android.com/reference/android/view/TextureView#getSurfaceTexture()` This value cannot be `null`. <br /> |
| `width` | `int`: The width of the surface <br /> |
| `height` | `int`: The height of the surface <br /> |

### onSurfaceTextureDestroyed

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean onSurfaceTextureDestroyed (SurfaceTexture surface)
```

Invoked when the specified `https://developer.android.com/reference/android/graphics/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 `https://developer.android.com/reference/android/graphics/SurfaceTexture#release()`. Most applications should return true.

<br />

| Parameters ||
|---|---|
| `surface` | `SurfaceTexture`: The surface about to be destroyed. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### onSurfaceTextureSizeChanged

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onSurfaceTextureSizeChanged (SurfaceTexture surface, 
                int width, 
                int height)
```

Invoked when the `https://developer.android.com/reference/android/graphics/SurfaceTexture`'s buffers size changed.

<br />

| Parameters ||
|---|---|
| `surface` | `SurfaceTexture`: The surface returned by `https://developer.android.com/reference/android/view/TextureView#getSurfaceTexture()` This value cannot be `null`. <br /> |
| `width` | `int`: The new width of the surface <br /> |
| `height` | `int`: The new height of the surface <br /> |

### onSurfaceTextureUpdated

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void onSurfaceTextureUpdated (SurfaceTexture surface)
```

Invoked when the specified `https://developer.android.com/reference/android/graphics/SurfaceTexture` is updated through `https://developer.android.com/reference/android/graphics/SurfaceTexture#updateTexImage()`.

<br />

| Parameters ||
|---|---|
| `surface` | `SurfaceTexture`: The surface just updated. This value cannot be `null`. <br /> |