Dil

DisplayManager.CreateVirtualDisplay Method

Definition

Overloads

CreateVirtualDisplay(VirtualDisplayConfig)

Creates a virtual display.

[Android.Runtime.Register("createVirtualDisplay", "(Landroid/hardware/display/VirtualDisplayConfig;)Landroid/hardware/display/VirtualDisplay;", "", ApiSince=34)]
public Android.Hardware.Display.VirtualDisplay? CreateVirtualDisplay(Android.Hardware.Display.VirtualDisplayConfig config);
[<Android.Runtime.Register("createVirtualDisplay", "(Landroid/hardware/display/VirtualDisplayConfig;)Landroid/hardware/display/VirtualDisplay;", "", ApiSince=34)>]
member this.CreateVirtualDisplay : Android.Hardware.Display.VirtualDisplayConfig -> Android.Hardware.Display.VirtualDisplay

Parameters

Returns

Attributes

Remarks

Creates a virtual display.

Java documentation for android.hardware.display.DisplayManager.createVirtualDisplay(android.hardware.display.VirtualDisplayConfig).

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.

Applies to

CreateVirtualDisplay(VirtualDisplayConfig, Handler, VirtualDisplay+Callback)

Creates a virtual display.

[Android.Runtime.Register("createVirtualDisplay", "(Landroid/hardware/display/VirtualDisplayConfig;Landroid/os/Handler;Landroid/hardware/display/VirtualDisplay$Callback;)Landroid/hardware/display/VirtualDisplay;", "", ApiSince=34)]
public Android.Hardware.Display.VirtualDisplay? CreateVirtualDisplay(Android.Hardware.Display.VirtualDisplayConfig config, Android.OS.Handler? handler, Android.Hardware.Display.VirtualDisplay.Callback? callback);
[<Android.Runtime.Register("createVirtualDisplay", "(Landroid/hardware/display/VirtualDisplayConfig;Landroid/os/Handler;Landroid/hardware/display/VirtualDisplay$Callback;)Landroid/hardware/display/VirtualDisplay;", "", ApiSince=34)>]
member this.CreateVirtualDisplay : Android.Hardware.Display.VirtualDisplayConfig * Android.OS.Handler * Android.Hardware.Display.VirtualDisplay.Callback -> Android.Hardware.Display.VirtualDisplay

Parameters

config
VirtualDisplayConfig

The configuration of the virtual display, must be non-null.

handler
Handler

The handler on which the listener should be invoked, or null if the listener should be invoked on the calling thread's looper.

callback
VirtualDisplay.Callback

Callback to call when the state of the VirtualDisplay changes. This value may be null.

Returns

The newly created virtual display, or null if the application could not create the virtual display.

Attributes

Remarks

Creates a virtual display.

The content of a virtual display is rendered to a Surface provided by the application.

The virtual display should be released when no longer needed. Because a virtual display renders to a surface provided by the application, it will be released automatically when the process terminates and all remaining windows on it will be forcibly removed.

The behavior of the virtual display depends on the flags that are provided to this method. By default, virtual displays are created to be private, non-presentation and unsecure. Permissions may be required to use certain flags.

As of Build.VERSION_CODES.KITKAT_WATCH, the surface may be attached or detached dynamically using VirtualDisplay.setSurface. Previously, the surface had to be non-null when createVirtualDisplay(VirtualDisplayConfig) was called and could not be changed for the lifetime of the display.

Detaching the surface that backs a virtual display has a similar effect to turning off the screen.

Android reference for android.hardware.display.DisplayManager.createVirtualDisplay.

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.

Applies to

CreateVirtualDisplay(String, Int32, Int32, Int32, Surface, VirtualDisplayFlags)

Creates a virtual display.

[Android.Runtime.Register("createVirtualDisplay", "(Ljava/lang/String;IIILandroid/view/Surface;I)Landroid/hardware/display/VirtualDisplay;", "")]
public Android.Hardware.Display.VirtualDisplay? CreateVirtualDisplay(string name, int width, int height, int densityDpi, Android.Views.Surface? surface, Android.Hardware.Display.VirtualDisplayFlags flags);
[<Android.Runtime.Register("createVirtualDisplay", "(Ljava/lang/String;IIILandroid/view/Surface;I)Landroid/hardware/display/VirtualDisplay;", "")>]
member this.CreateVirtualDisplay : string * int * int * int * Android.Views.Surface * Android.Hardware.Display.VirtualDisplayFlags -> Android.Hardware.Display.VirtualDisplay

Parameters

name
String
width
Int32

Value is 1 or greater

height
Int32

Value is 1 or greater

densityDpi
Int32

Value is 1 or greater

surface
Surface
flags
VirtualDisplayFlags

Value is either 0 or a combination of the following: VIRTUAL_DISPLAY_FLAG_PUBLIC; VIRTUAL_DISPLAY_FLAG_PRESENTATION; VIRTUAL_DISPLAY_FLAG_SECURE; VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY; VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR

Returns

Attributes

Remarks

Creates a virtual display.

Java documentation for android.hardware.display.DisplayManager.createVirtualDisplay(java.lang.String, int, int, int, android.view.Surface, int).

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.

See also

  • <xref:Android.Hardware.Display.DisplayManager.CreateVirtualDisplay(System.String%2c+System.Int32%2c+System.Int32%2c+System.Int32%2c+System.Int32%2c+System.Int32%2c+System.Int32%2c+System.Int32)>

Applies to

CreateVirtualDisplay(String, Int32, Int32, Int32, Surface, VirtualDisplayFlags, VirtualDisplay+Callback, Handler)

Creates a virtual display.

[Android.Runtime.Register("createVirtualDisplay", "(Ljava/lang/String;IIILandroid/view/Surface;ILandroid/hardware/display/VirtualDisplay$Callback;Landroid/os/Handler;)Landroid/hardware/display/VirtualDisplay;", "")]
public Android.Hardware.Display.VirtualDisplay? CreateVirtualDisplay(string name, int width, int height, int densityDpi, Android.Views.Surface? surface, Android.Hardware.Display.VirtualDisplayFlags flags, Android.Hardware.Display.VirtualDisplay.Callback? callback, Android.OS.Handler? handler);
[<Android.Runtime.Register("createVirtualDisplay", "(Ljava/lang/String;IIILandroid/view/Surface;ILandroid/hardware/display/VirtualDisplay$Callback;Landroid/os/Handler;)Landroid/hardware/display/VirtualDisplay;", "")>]
member this.CreateVirtualDisplay : string * int * int * int * Android.Views.Surface * Android.Hardware.Display.VirtualDisplayFlags * Android.Hardware.Display.VirtualDisplay.Callback * Android.OS.Handler -> Android.Hardware.Display.VirtualDisplay

Parameters

name
String

The name of the virtual display, must be non-empty.

width
Int32

The width of the virtual display in pixels, must be greater than 0.

height
Int32

The height of the virtual display in pixels, must be greater than 0.

densityDpi
Int32

The density of the virtual display in dpi, must be greater than 0.

surface
Surface

The surface to which the content of the virtual display should be rendered, or null if there is none initially.

callback
VirtualDisplay.Callback

Callback to call when the state of the VirtualDisplay changes

handler
Handler

The handler on which the listener should be invoked, or null if the listener should be invoked on the calling thread's looper.

Returns

The newly created virtual display, or null if the application could not create the virtual display.

Attributes

Exceptions

if the caller does not have permission to create a virtual display with the specified flags.

Remarks

Creates a virtual display.

The content of a virtual display is rendered to a Surface provided by the application.

The virtual display should be released when no longer needed. Because a virtual display renders to a surface provided by the application, it will be released automatically when the process terminates and all remaining windows on it will be forcibly removed.

The behavior of the virtual display depends on the flags that are provided to this method. By default, virtual displays are created to be private, non-presentation and unsecure. Permissions may be required to use certain flags.

As of Build.VERSION_CODES.KITKAT_WATCH, the surface may be attached or detached dynamically using VirtualDisplay.setSurface. Previously, the surface had to be non-null when createVirtualDisplay(VirtualDisplayConfig) was called and could not be changed for the lifetime of the display.

Detaching the surface that backs a virtual display has a similar effect to turning off the screen.

Android reference for android.hardware.display.DisplayManager.createVirtualDisplay.

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.

Applies to