ActivityPanelEntity
public final class ActivityPanelEntity extends PanelEntity
| java.lang.Object | ||||
| ↳ | androidx.xr.scenecore.BaseScenePose | |||
| ↳ | androidx.xr.scenecore.Entity | |||
| ↳ | androidx.xr.scenecore.PanelEntity | |||
| ↳ | androidx.xr.scenecore.ActivityPanelEntity |
ActivityPanelEntity creates a spatial panel for embedding an Activity in Android XR. Users can either use an Intent to launch an Activity in the given panel or provide an instance of Activity to move into this panel. In order to launch and embed an activity, SpatialCapability.EMBED_ACTIVITY capability is required. When this Entity is destroyed it will destroy the underlying Activity.
Summary
Public methods |
|
|---|---|
static final @NonNull ActivityPanelEntity |
create(Public factory function for a spatial ActivityPanelEntity. |
final void |
startActivity(@NonNull Intent intent)Starts an |
final void |
transferActivity(@NonNull Activity activity)Transfers the given |
Inherited methods |
||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
|
Public methods
create
public static final @NonNull ActivityPanelEntity create(
@NonNull Session session,
@NonNull IntSize2d pixelDimensions,
@NonNull String name,
@NonNull Pose pose,
Entity parent
)
Public factory function for a spatial ActivityPanelEntity.
| Parameters | |
|---|---|
@NonNull Session session |
XR |
@NonNull IntSize2d pixelDimensions |
Bounds for the panel surface in pixels. |
@NonNull String name |
Name of the panel. |
@NonNull Pose pose |
|
Entity parent |
Parent entity. Defaults to |
| Returns | |
|---|---|
@NonNull ActivityPanelEntity |
an ActivityPanelEntity instance. |
startActivity
public final void startActivity(@NonNull Intent intent)
Starts an Activity in the given panel. Subsequent calls to this method will replace the already existing Activity in the panel with the new one. The panel will not be visible until an Activity is successfully launched. This will fail if the Scene does not have the SpatialCapability.EMBED_ACTIVITY capability. This method will not provide any information about when the Activity successfully launches.
transferActivity
public final void transferActivity(@NonNull Activity activity)
Transfers the given Activity into this panel. This will fail if the application does not have the SpatialCapability.EMBED_ACTIVITY capability.