HardwareRenderer.SetSurface(Surface) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The surface to render into.
[Android.Runtime.Register("setSurface", "(Landroid/view/Surface;)V", "GetSetSurface_Landroid_view_Surface_Handler", ApiSince=29)]
public virtual void SetSurface (Android.Views.Surface? surface);
[<Android.Runtime.Register("setSurface", "(Landroid/view/Surface;)V", "GetSetSurface_Landroid_view_Surface_Handler", ApiSince=29)>]
abstract member SetSurface : Android.Views.Surface -> unit
override this.SetSurface : Android.Views.Surface -> unit
Parameters
- surface
- Surface
The surface to render into. If null then rendering will be stopped. If
non-null then Surface#isValid()
must be true.
- Attributes
Remarks
The surface to render into. The surface is assumed to be associated with the display and as such is still driven by vsync signals such as those from android.view.Choreographer
and that it has a native refresh rate matching that of the display's (typically 60hz).
NOTE: Due to the shared, cooperative nature of the render thread it is critical that any Surface
used must have a prompt, reliable consuming side. System-provided consumers such as android.view.SurfaceView
, android.view.Window#takeSurface(SurfaceHolder.Callback2)
, or android.view.TextureView
all fit this requirement. However if custom consumers are used such as when using SurfaceTexture
or android.media.ImageReader
it is the app's responsibility to ensure that they consume updates promptly and rapidly. Failure to do so will cause the render thread to stall on that surface, blocking all HardwareRenderer instances.
Java documentation for android.graphics.HardwareRenderer.setSurface(android.view.Surface)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.