ActivityPanelEntity


public final class ActivityPanelEntity extends PanelEntity


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. Calling Entity.dispose on this Entity will destroy the underlying Activity.

Summary

Public methods

static final @NonNull ActivityPanelEntity
create(
    @NonNull Session session,
    @NonNull IntSize2d pixelDimensions,
    @NonNull String name,
    @NonNull Pose pose
)

Public factory function for a spatial ActivityPanelEntity.

final void
launchActivity(@NonNull Intent intent, Bundle bundle)

Launches an Activity in the given panel.

final void

Moves the given Activity into this panel.

Inherited methods

From androidx.xr.scenecore.Entity
@FloatRange(from = 0.0, to = 1.0) float

Returns the alpha transparency set for this Entity.

@NonNull Pose

Returns the Pose for this Entity, relative to its parent.

@FloatRange(from = 0.0) float

Returns the local scale of this Entity, not inclusive of the parent's scale.

void
setAlpha(@FloatRange(from = 0.0, to = 1.0) float alpha)

Sets the alpha transparency of the Entity and its children.

void

Sets the Pose for this Entity, relative to its parent.

void
setScale(@FloatRange(from = 0.0) float scale)

Sets the scale of this Entity relative to its parent.

From androidx.xr.scenecore.PanelEntity
final float

The corner radius of the PanelEntity, in meters.

final @NonNull PerceivedResolutionResult

Gets the perceived resolution of this Entity in the CameraView.

final @NonNull FloatSize2d

The dimensions of this PanelEntity in local space, in units relative to the scale of this Entity's parent.

final @NonNull IntSize2d

The dimensions of this PanelEntity, in pixels, which is the resolution of the underlying surface.

final boolean

True if this panel is the MainPanelEntity, false otherwise.

final void
setCornerRadius(float cornerRadius)

The corner radius of the PanelEntity, in meters.

final void

The dimensions of this PanelEntity in local space, in units relative to the scale of this Entity's parent.

final void

The dimensions of this PanelEntity, in pixels, which is the resolution of the underlying surface.

From androidx.xr.scenecore.ScenePose
abstract @NonNull Pose

The current Pose relative to the activity space root.

abstract @NonNull HitTestResult
hitTest(@NonNull Vector3 origin, @NonNull Vector3 direction)

Creates a hit test from the specified origin in the specified direction into the Scene.

abstract @NonNull HitTestResult
hitTest(
    @NonNull Vector3 origin,
    @NonNull Vector3 direction,
    int hitTestFilter
)

Creates a hit test from the specified origin in the specified direction into the scene.

abstract @NonNull Pose
transformPoseTo(@NonNull Pose pose, @NonNull ScenePose destination)

Returns a Pose relative to this ScenePose, transformed into a Pose relative to the destination.

Public methods

create

Added in 1.0.0-alpha05
public static final @NonNull ActivityPanelEntity create(
    @NonNull Session session,
    @NonNull IntSize2d pixelDimensions,
    @NonNull String name,
    @NonNull Pose pose
)

Public factory function for a spatial ActivityPanelEntity.

Parameters
@NonNull Session session

XR Session to create the ActivityPanelEntity.

@NonNull IntSize2d pixelDimensions

Bounds for the panel surface in pixels.

@NonNull String name

Name of the panel.

@NonNull Pose pose

Pose of this entity relative to its parent, the default value is Pose.Identity.

Returns
@NonNull ActivityPanelEntity

an ActivityPanelEntity instance.

launchActivity

Added in 1.0.0-alpha05
public final void launchActivity(@NonNull Intent intent, Bundle bundle)

Launches 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 method will not provide any information about when the Activity successfully launches.

Parameters
@NonNull Intent intent

Intent to launch the activity.

Bundle bundle

Bundle to pass to the activity, can be null.

moveActivity

Added in 1.0.0-alpha05
public final void moveActivity(@NonNull Activity activity)

Moves the given Activity into this panel.

Parameters
@NonNull Activity activity

Activity to move into this panel.