Android 12 Developer Preview is here! Try it out, and give us your feedback!

SurfaceContainer

public final class SurfaceContainer
extends Object

java.lang.Object
   ↳ androidx.car.app.SurfaceContainer


A container for the Surface created by the host and its associated properties.

Summary

Public constructors

SurfaceContainer(Surface surface, int width, int height, int dpi)

Public methods

int getDpi()

Returns the pixel density of the surface or 0 if the surface is not ready.

int getHeight()

Returns the height of the surface or 0 if the surface is not ready.

Surface getSurface()

Returns the Surface held by the host or null if the surface is not ready.

int getWidth()

Returns the width of the surface or 0 if the surface is not ready.

String toString()

Inherited methods

Public constructors

SurfaceContainer

public SurfaceContainer (Surface surface, 
                int width, 
                int height, 
                int dpi)

Parameters
surface Surface

width int

height int

dpi int

Public methods

getDpi

public int getDpi ()

Returns the pixel density of the surface or 0 if the surface is not ready.

Returns
int

getHeight

public int getHeight ()

Returns the height of the surface or 0 if the surface is not ready.

Returns
int

getSurface

public Surface getSurface ()

Returns the Surface held by the host or null if the surface is not ready.

Returns
Surface

getWidth

public int getWidth ()

Returns the width of the surface or 0 if the surface is not ready.

Returns
int

toString

public String toString ()

Returns
String