C

ActivityView Properties Changer

Demonstrates how to interact with ActivityView properties.

"ActivityView Properties Example Screenshot"

Building and deploying the example

See specific steps relating to building and deploying Qt for Android Automotive examples.

Overview

This example shows how to interact with ActivityView properties by changing a property's state at run-time and observing how it impacts the application. On a currently used Android version, this might be useful for checking the behavior of an application embedded inside an ActivityView item.

Application structure

This example embeds the Activity of a selected package ( com.android.deskclock by default) inside an ActivityView item handled by the Loader which is wrapped inside the Rectangle with frame. The active application can be changed by setting the packageName and className parameters. className is optional.

First, we import the QML API

Toggling the properties

This example allows toggling the state of the following properties at run-time:

  • ActivityView visible: switches the state of the visible property of the ActivityView item.
  • ActivityView parent visible: switches the state of the visible property of the ActivityView's parent Rectangle frame.
  • ActivityView has parent: changes the assignment of ActivityView's parent. If "ON", a Rectangle with a frame is assigned as ActivityView's parent. Otherwise, ActivityView is stand-alone without a parent.

    Note: setting this property to off causes destruction of ActivityView. If set to on after being set to off the item is created from scratch. This is unlike the show or hide behavior of the other properties.

  • Loader active: changes the state of the Loader that is handling ActivityView's content.

These switches enable checking the behavior of ActivityView with different property states, and how they impact the active application (the Activityof the selected package).

Available under certain Qt licenses.
Find out more.