setAndroidSurfaceTarget method

Future<void> setAndroidSurfaceTarget(
  1. AndroidSurfaceReplacement replacement
)

Replaces the Android window that the session presents to.

Use it to give the session a window again after RenderSessionHandle.releaseTarget(), to move it to another window, or to resize it. Once the replacement completes, the session no longer uses the old window.

See mln_render_session_set_android_surface_target in the C API reference.

Errors:

  • Status.invalidArgument when surface has no window, such as after the platform destroyed it.
  • Status.unsupported when, in a Vulkan build, the new window needs a different color format or pre-rotation support than the old one. Attach a new session instead.
  • Status.nativeError when the library can't create the window's surface.

Implementation

Future<void> setAndroidSurfaceTarget(AndroidSurfaceReplacement replacement) =>
    _run(
      (arena, completion) =>
          raw.mln_render_session_set_android_surface_target(
            _handle.raw,
            _writeAndroidSurfaceReplacement(replacement, arena),
            completion,
            nativeDiagnostic,
          ),
    );