SurfaceControlCallback


public interface SurfaceControlCallback


A host-side interface for reporting to an off-process renderer events affecting the android.view.SurfaceView it renders content on.

Public methods

default void

Notifies when there is an error.

abstract void

Notifies when android.view.SurfaceView receives a new key event.

abstract void

Notifies when android.view.SurfaceView receives a new touch event.

abstract void
onWindowFocusChanged(boolean hasFocus, boolean isInTouchMode)

Notifies when the window focus changes.

abstract void

Notifies when the underlying surface changes.

Public methods

onError

Added in 1.1.0
default void onError(@NonNull String msg, @NonNull Throwable e)

Notifies when there is an error. Provide default implementation for easier transition.

onKeyEvent

Added in 1.1.0
abstract void onKeyEvent(@NonNull KeyEvent event)

Notifies when android.view.SurfaceView receives a new key event.

onTouchEvent

Added in 1.1.0
abstract void onTouchEvent(@NonNull MotionEvent event)

Notifies when android.view.SurfaceView receives a new touch event.

onWindowFocusChanged

Added in 1.1.0
abstract void onWindowFocusChanged(boolean hasFocus, boolean isInTouchMode)

Notifies when the window focus changes.

setSurfaceWrapper

Added in 1.1.0
abstract void setSurfaceWrapper(@NonNull SurfaceWrapper surfaceWrapper)

Notifies when the underlying surface changes.

The Layout Inspector in Android Studio lets you compare your app layout with design mockups, display a magnified view of your app, and examine details of its layout at runtime.

Updated Jan 9, 2025

Learn how to use extended controls on the Android Emulator.

Updated Jul 10, 2024

The developer center about creating games for Android. Learn how to develop, optimize, and publish your Android game using the latest tools and SDKs.

Updated Jun 20, 2024