ActivityPanelEntity


class ActivityPanelEntity : 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 companion functions

ActivityPanelEntity
create(
    session: Session,
    pixelDimensions: IntSize2d,
    name: String,
    pose: Pose
)

Public factory function for a spatial ActivityPanelEntity.

Public functions

Unit
launchActivity(intent: Intent, bundle: Bundle?)

Launches an Activity in the given panel.

Unit

Moves the given Activity into this panel.

Inherited functions

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

Returns the alpha transparency set for this Entity.

open Pose

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

open @FloatRange(from = 0.0) Float

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

open Unit
setAlpha(alpha: @FloatRange(from = 0.0, to = 1.0) Float)

Sets the alpha transparency of the Entity and its children.

open Unit
setPose(pose: Pose)

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

open Unit
setScale(scale: @FloatRange(from = 0.0) Float)

Sets the scale of this Entity relative to its parent.

From androidx.xr.scenecore.PanelEntity
PerceivedResolutionResult

Gets the perceived resolution of this Entity in the CameraView.

From androidx.xr.scenecore.ScenePose
abstract suspend HitTestResult
hitTest(origin: Vector3, direction: Vector3)

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

abstract suspend HitTestResult
hitTest(origin: Vector3, direction: Vector3, hitTestFilter: Int)

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

abstract Pose
transformPoseTo(pose: Pose, destination: ScenePose)

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

Inherited properties

From androidx.xr.scenecore.PanelEntity
Float

The corner radius of the PanelEntity, in meters.

Boolean

True if this panel is the MainPanelEntity, false otherwise.

FloatSize2d

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

IntSize2d

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

From androidx.xr.scenecore.ScenePose
abstract Pose

The current Pose relative to the activity space root.

Public companion functions

create

Added in 1.0.0-alpha05
fun create(
    session: Session,
    pixelDimensions: IntSize2d,
    name: String,
    pose: Pose = Pose.Identity
): ActivityPanelEntity

Public factory function for a spatial ActivityPanelEntity.

Parameters
session: Session

XR Session to create the ActivityPanelEntity.

pixelDimensions: IntSize2d

Bounds for the panel surface in pixels.

name: String

Name of the panel.

pose: Pose = Pose.Identity

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

Returns
ActivityPanelEntity

an ActivityPanelEntity instance.

Public functions

launchActivity

Added in 1.0.0-alpha05
fun launchActivity(intent: Intent, bundle: Bundle? = null): Unit

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
intent: Intent

Intent to launch the activity.

bundle: Bundle? = null

Bundle to pass to the activity, can be null.

moveActivity

Added in 1.0.0-alpha05
fun moveActivity(activity: Activity): Unit

Moves the given Activity into this panel.

Parameters
activity: Activity

Activity to move into this panel.