[Android-development] Hybrid applications with partly native UI?

Pekka Nikander pekka.nikander at iki.fi
Sun Feb 15 12:43:40 CET 2015


I'm not BogDan, but I did spend some time in trying to understand the Qt Android integration.

> I have poor knowledge of the underlying integration between the Android and Qt UI.

Unless I'm completely mistaken, the integration tries to use as much as possible the public Android APIs and confine with Android UI conventions.  This is clearly a deliberate design choice -- there are alternative choices, such as interfacing directly with the Android WindowManagerService either through the WindowManager API or even directly from C++ over the Binder interface.

That said, a Qt Window is mapped onto an Android SurfaceView, which is an Android interface to the underlying OpenGL ES window.  IIRC, the Java side of Qt runtime creates an SurfaceView, then acquires a reference to the underlying OpenGL ES window, passes it to the C++ side of the Qt runtime, and draws directly to it using C++.  However, I never dug very deeply into that side, mostly focusing on the WindowManager interactions.

> Hence the question, is it possible to have Qt rendering be confined to a native android View?

Well, with a relatively small extension you can most probably create an Android SurfaceView pass it to the underlying Qt.  AFAICS, the biggest problem would be event handling.  While the Android Java-level events are passed IIRC from the QtActivityDelegate to the Qt C++ side, the QtActivityDelegate isn't really designed to be extensible.  I presume you could interface to it directly from your own Activity subclass, though.  How to do that, exactly, I don't know.

> So have a Qt app think that a particular View on screen is the display, while rest of the UI would be Java?

No, I don't think you can do that.  You still need to have a Java SurfaceView for each Qt window.  Of course, if you use just one Qt Window and many Widgets within the window, you would probably get pretty close.

--Pekka

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4891 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20150215/6ff3ca0f/attachment.bin>


More information about the Android-development mailing list