C
Embedded Clock and Contacts Apps
An app that embeds the Clock and Contacts apps in floating window using Activity View Dialogs.
Building and deploying the example
See specific steps relating to building and deploying Qt for Android Automotive examples.
Including the API
To use the ActivityView plugin in Qt Quick application, first, we have to import the QtAA ActivityView module in QML:
import QtAndroidAutomotive.ActivityView
Wrapping an application inside the floating window
Now, it's possible to use the ActivityView QML API to define the floating window component, ActivityViewWindow
. The component is based on FloatingWindow
, defined in FloatingWindow.qml, and encapsulates visual appearance and behavior.
Defining ActivityView
The ActivityView related functionality is covered by the ActivityView
item placed inside FloatingWindow
, and sets parameters of each embedded Activity.
ActivityView { id: activityView anchors.fill: parent anchors.margins: activityMargin radius: 25 usePlaceholder: activityViewWindow.resizing || activityViewWindow.moving placeholder: Item { Image { id: iconImage anchors.centerIn: parent } } BusyIndicator { anchors.centerIn: parent visible: activityView.status !== ActivityView.Status.Started }
With the ActivityViewWindow
component we can now define two floating windows, which will wrap the Activities of Android Applications. In this example we are embedding the Clock and Contacts applications inside two windows.
ActivityViewWindow { id: firstWindow title: "Clock" packageName: "com.android.deskclock" icon: Qt.resolvedUrl("icons/icon_clock.png") visible: false } ActivityViewWindow { id: secondWindow title: "Contacts" packageName: "com.android.contacts" icon: Qt.resolvedUrl("icons/icon_contacts.png") visible: false }
Available under certain Qt licenses.
Find out more.