Embedding Android Activities with Full Qt Quick Features

Qt for Android Automotive has introduced a transformative new back-end for the ActivityView module, significantly advancing user interface development on Android Automotive. Moving beyond the limitations of traditional Java APIs offered by AOSP, this advanced back-end enables fluid integration of third-party Android apps directly into the Qt Quick applications. This brings a new level of flexibility to Qt for Android Automotive user interfaces. 

The 'Textured' Backend for Qt ActivityView

The new "textured" backend of Qt ActivityView, allows Android Activities to be embedded as regular Qt Quick Items. This capability means developers can use all of Qt Quick’s features, including transformations, effects, shader effects, animations, and z-ordering, to achieve greater control over their applications' visual and interactive elements.  

The code snippet below runs and embeds Desk Clock app in a Qt Quick window. 

ActivityView {
    id: activityView
    width: 640; height: 480;
    packageName: "com.android.deskclock"
}

How does it work? 

The ActivityView Quick item launches the target activity in an off-screen context, obtains it as an ExternalOES texture, and renders it with a custom QSGMaterialShader. Any touch events received by the item are transformed to match the activity’s actual coordinate space before being forwarded to the underlying activity. 

 

In Qt for Android Automotive 6.8, we revamped the ActivityView Dialogs example to simulate a basic windowing system within a Qt Quick application. It allows you to launch and interact with two predefined apps.

 

The new public API of the QML ActivityView type has been kept source-compatible with earlier versions of Qt. At the same time, many known issues have been resolved. 


Blog Topics:

Comments