CN112882706B - Implementation method and system for Android native and QT mixed development - Google Patents

Implementation method and system for Android native and QT mixed development Download PDF

Info

Publication number
CN112882706B
CN112882706B CN202110247533.XA CN202110247533A CN112882706B CN 112882706 B CN112882706 B CN 112882706B CN 202110247533 A CN202110247533 A CN 202110247533A CN 112882706 B CN112882706 B CN 112882706B
Authority
CN
China
Prior art keywords
interface
layout
android
activity
sub
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110247533.XA
Other languages
Chinese (zh)
Other versions
CN112882706A (en
Inventor
谭帅
郭卫斌
马骥
王佳
王超
王平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengzhou Xinda Jiean Information Technology Co Ltd
Original Assignee
Zhengzhou Xinda Jiean Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou Xinda Jiean Information Technology Co Ltd filed Critical Zhengzhou Xinda Jiean Information Technology Co Ltd
Priority to CN202110247533.XA priority Critical patent/CN112882706B/en
Publication of CN112882706A publication Critical patent/CN112882706A/en
Application granted granted Critical
Publication of CN112882706B publication Critical patent/CN112882706B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Abstract

The invention provides a method and a system for realizing Android native and QT mixed development. The method comprises the following steps: the method comprises the steps of predetermining the size and position relation of a QT interface and an Android native interface displayed in the same Activity; when the Activity of the application is created, setting a Layout file in a user-defined mode based on the size and the position relation, and dividing the overall Layout into a sub-Layout and other sub-Layout layouts to which a QT interface belongs; in the QT initialization process, creating a Surface based on an Android system environment, and attaching the created Surface to a sub-Layout to which a QT interface belongs; developing at least one QT interface through the QT framework, and displaying the at least one QT interface on the Surface; at least one Activity is developed through an Android native development framework, and the Surface of the QT is associated to at least one sub-Layout corresponding to the QT interface of the Activity. The invention can realize the picture fusion.

Description

Implementation method and system for Android native and QT mixed development
Technical Field
The invention relates to the technical field of application program development, in particular to a method and a system for realizing Android native and QT mixed development.
Background
Along with the development of automobiles, QT has wider and wider application in the field of vehicle-mounted systems, is mainly applied to application development of automobile instruments, infotainment systems, rear-row entertainment systems and the like, and has certain advantages in the aspect of developing 3D application compared with Android native development; the Android native development applicability is wider, and many third-party libraries only provide libraries for Android native development; if in application development, combine both to use, accomplish different functions separately, can not only improve development efficiency, combine the advantage of QT in the aspect of 3D and can realize more cool effects moreover.
The existing QT is cross-platform and can be transplanted to an Android platform, and in application development, components such as Activity and Service are allowed to be expanded, and interaction between QT application and the Android component is supported; but the same Activity can only display the interface developed by QT (named QT interface for short) or the interface developed by Android native (named Android native interface for short); the flexibility and application scenes of the combination of the two are greatly limited, for example, in the field of automobiles, a vehicle 3D interface developed by QT and map navigation information originally developed by Android need to be displayed on a screen; for the existing QT development, map information and 3D vehicle information cannot be displayed on one screen at the same time, and information fusion cannot be realized; the user needs to operate to switch the display between the two (as shown in fig. 1); this increases the driving risk to some extent.
Disclosure of Invention
Aiming at the problem that the QT interface and the Android native interface cannot be displayed on the same screen in the conventional QT development, the invention provides a method and a system for realizing the mixed development of the Android native interface and the QT interface.
On one hand, the invention provides a method for realizing Android native and QT mixed development, which comprises the following steps:
step 1: the method comprises the steps of predetermining the size and position relation of a QT interface and an Android native interface displayed in the same Activity;
step 2: when the Activity of the application is created, setting a Layout file in a user-defined mode based on the size and the position relation, and dividing the overall Layout into a sub-Layout and other sub-Layout layouts to which a QT interface belongs;
and step 3: in the QT initialization process, creating a Surface based on an Android system environment, and attaching the created Surface to a sub-Layout to which a QT interface belongs;
and 4, step 4: developing at least one QT interface through the QT framework, and displaying the at least one QT interface on the Surface; at least one Activity is developed through an Android native development framework, and the Surface of the QT is associated to at least one sub-Layout corresponding to the QT interface of the Activity.
Further, after the step 2, the method further comprises the following steps:
and modifying the layout file, and customizing the position relation and the size of the QT interface and the Android native interface.
Further, the position relation and the size of the user-defined QT interface and the Android native interface specifically include:
and self-defining the QT interface and the Android native interface into an up-down layout mode, a left-right layout mode or a mode that the QT interface covers the Android native interface.
Furthermore, the overall Layout of the application is managed by an Android window management system, the QT interface is displayed on the Surface as a sub-Layout, and windows and controls inside the QT interface are managed by the QT window management system to be displayed.
Further, after the step 4, the method further comprises:
when the application is started, firstly starting the Activity corresponding to the application on the Android native development frame side;
loading the layout file corresponding to the Activity, and starting a QT framework;
initializing a QT window management system on the QT frame side;
creating a Surface by a QT frame based on an Android system environment;
acquiring a sublevel Layout to which a QT interface belongs;
adding the created Surface to the Layout to which the QT interface belongs;
and displaying the QT interface on the Surface, and simultaneously displaying the Android native interface on other sub-Layout to realize the same-screen display of the QT interface and the Android native interface.
Further, the QT interface is used for displaying 3D vehicle information, and the Android native interface is used for displaying map navigation information.
On the other hand, the invention also provides a system for realizing the mixed development of the Android native and QT, which comprises the following steps: an Android native development framework and a QT framework;
the Android native development framework is used for creating at least one Activity of an application, setting Layout files in a user-defined mode based on the size and position relation of a QT interface and an Android native interface displayed in the same Activity, and dividing the overall Layout into a sub-Layout to which the QT interface belongs and other sub-layouts Layout layouts; and associating the Surface of the QT to the Layout corresponding to the QT interface corresponding to the Activity;
the QT framework is used for creating a Surface based on an Android system environment and attaching the created Surface to a sub-Layout to which a QT interface belongs; and for developing at least one QT interface and displaying at least one of the QT interfaces onto a Surface.
Furthermore, the overall Layout of the application is managed by an Android window management system, a QT interface is displayed on a surface as a sub-Layout, and windows and controls inside the QT interface are managed by the QT window management system to be displayed.
The invention has the beneficial effects that:
according to the method, the upper flow of the QT frame is modified, when the Surface is created by the QT, the created Surface is attached to the Layout designated to the QT, and the Layout designated to the QT is used as a sub Layout of the overall Activity, so that the interface developed by the QT and the interface developed by the Android are displayed on the same Activity, and the fusion of pictures is realized. In addition, the position relation and the size layout of the QT interface and the Android native interface can be combined at will, and the layout modes such as up-down, left-right or QT covering Android and the like can be customized, so that the diversity of image fusion is further realized, and the visual experience of different users is met.
Drawings
FIG. 1 is a diagram illustrating the effect of Android and QT hybrid development realized in the prior art;
fig. 2 is a schematic flowchart of a method for implementing Android native and QT hybrid development according to an embodiment of the present invention;
FIG. 3 is a schematic layout diagram according to an embodiment of the present invention;
fig. 4 is a same-screen display effect diagram of a QT interface and an Android native interface in the same Activity provided by the embodiment of the present invention;
fig. 5 is a schematic diagram of an Activity initiation process for mixed development of Android native and QT according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 2 and fig. 3, an embodiment of the present invention provides a method for implementing Android native and QT hybrid development, where the method includes the following steps:
s101: the method comprises the steps of predetermining the size and position relation of a QT interface and an Android native interface displayed in the same Activity;
in particular, Activity, one of the four major components of Android, is an application component that provides an area on the screen on which the user is allowed to do interactive operations, such as making a phone call, taking a picture, sending a mail, or displaying a map. Activity may be understood as a window that draws a user interface, and this window may fill the entire screen, may be smaller than the screen, or may float above other windows.
S102: when the Activity of the application is created, setting a Layout file in a user-defined mode based on the size and the position relation, and dividing the overall Layout into a sub-Layout and other sub-Layout layouts to which a QT interface belongs;
s103: in the QT initialization process, creating a Surface based on an Android system environment, and attaching the created Surface to a sub-Layout to which a QT interface belongs;
s104: developing at least one QT interface through the QT framework, and displaying the at least one QT interface on the Surface; at least one Activity is developed through an Android native development framework, and the Surface of the QT is associated to at least one sub-Layout corresponding to the QT interface of the Activity.
In particular, QT is a cross-platform C + + graphical user interface application development framework. It can be used to develop both GUI and non-GUI programs, such as console tools and servers. QTs are object-oriented frameworks that use special code to generate extensions and some macros, which are easily extended and allow true component programming.
According to the embodiment of the invention, by modifying the QT framework flow, the QT interface can be displayed in the same Activity, and the Android native interface can also be displayed at the same time. As shown in fig. 4, the map navigation information and the 3D vehicle information can be displayed on the screen at the same time, and the information fusion is realized.
On the basis of the above embodiment, after the step S102, the method further includes:
and modifying the layout file, and customizing the position relation and the size of the QT interface and the Android native interface.
As an implementable manner, the position relationship and the size of the custom QT interface and the Android native interface specifically include: and self-defining the QT interface and the Android native interface into an up-down layout mode, a left-right layout mode or a mode that the QT interface covers the Android native interface. It is to be understood that the layout pattern is not limited to the above three ways.
In the embodiment of the invention, the integral Layout of the application is managed by an Android window management system, the QT interface is displayed on the Surface as a sub-Layout, and the window and control display in the QT interface is managed by the QT window management system.
On the basis of the foregoing embodiments, as shown in fig. 5, after the step S104, a hybrid development Activity starting procedure is further included, and the specific steps include:
when the application is started, firstly starting the Activity corresponding to the application on the Android native development frame side;
loading the layout file corresponding to the Activity, and starting a QT framework;
initializing a QT window management system on the QT frame side;
creating a Surface by a QT frame based on an Android system environment;
acquiring a sublevel Layout to which a QT interface belongs;
adding the created Surface to the Layout to which the QT interface belongs;
and displaying the QT interface on the Surface, and simultaneously displaying the Android native interface on other sub-Layout to realize the same-screen display of the QT interface and the Android native interface.
As an implementable embodiment, the QT interface is used to display 3D vehicle information; the Android native interface is used for displaying map navigation information. It is to be understood that the display information of the two interfaces is not limited to the above-described information types.
By adopting the technical scheme of the embodiment of the invention, particularly in the field of automobiles, the map navigation information and the 3D vehicle information can be simultaneously displayed on one screen, the fusion of two types of different information is realized, the frequent operation of a user is not needed, the switching display is carried out between the two types of different information, and the driving risk of the user is reduced.
Corresponding to the implementation method for the mixed development of the Android native and the QT, the embodiment of the present invention further provides an implementation system for the mixed development of the Android native and the QT, including: an Android native development framework and a QT framework;
the Android native development framework is used for creating at least one Activity of an application, setting Layout files in a user-defined mode based on the size and position relation of a QT interface and an Android native interface displayed in the same Activity, and dividing the overall Layout into a sub-Layout to which the QT interface belongs and other sub-layouts Layout layouts; and associating the Surface of the QT to the Layout corresponding to the QT interface corresponding to the Activity;
the QT framework is used for creating a Surface based on an Android system environment and attaching the created Surface to a sub-Layout to which a QT interface belongs; and for developing at least one QT interface and displaying at least one of the QT interfaces onto a Surface.
On the basis of the embodiment, the overall Layout of the application is managed by an Android window management system, the QT interface is displayed on the surface as a sub-Layout, and the QT window management system manages the display of windows and controls inside the QT interface.
The invention provides a method and a system for realizing QT and Android native mixed development, which are characterized in that the upper flow of a QT frame is modified, when a Surface is created by QT, the created Surface is attached to a Layout appointed to the QT, and the Layout appointed to the QT is used as a sub Layout of the Activity overall Layout, so that a QT interface and an Android native interface are displayed on the same Activity, and the fusion of pictures is realized. In addition, the position relation and the size layout of the QT interface and the Android native interface can be combined at will, and the layout modes such as up-down, left-right or QT covering Android and the like can be customized, so that the diversity of image fusion is further realized, and the visual experience of different users is met.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (7)

1. A realization method for Android native and QT mixed development is characterized by comprising the following steps:
step 1: the method comprises the steps of predetermining the size and position relation of a QT interface and an Android native interface displayed in the same Activity;
step 2: when the Activity of the application is created, setting a Layout file in a user-defined mode based on the size and the position relation, and dividing the overall Layout into a sub-Layout and other sub-Layout layouts to which a QT interface belongs;
and step 3: in the QT initialization process, creating a Surface based on an Android system environment, and attaching the created Surface to a sub-Layout to which a QT interface belongs;
and 4, step 4: developing at least one QT interface through the QT framework, and displaying the at least one QT interface on the Surface; developing at least one Activity through an Android native development framework, and associating the Surface of the QT to at least one sub-Layout to which a QT interface corresponding to the Activity belongs;
after the step 4, further comprising:
when the application is started, firstly starting the Activity corresponding to the application on the Android native development frame side;
loading the layout file corresponding to the Activity, and starting a QT framework;
initializing a QT window management system on the QT frame side;
creating a Surface by a QT frame based on an Android system environment;
acquiring a sublevel Layout to which a QT interface belongs;
adding the created Surface to the Layout to which the QT interface belongs;
and displaying the QT interface on the Surface, and simultaneously displaying the Android native interface on other sub-Layout to realize the same-screen display of the QT interface and the Android native interface.
2. The method of claim 1, further comprising, after step 2:
and modifying the layout file, and customizing the position relation and the size of the QT interface and the Android native interface.
3. The method according to claim 2, wherein the position relationship and the size of the custom QT interface and the Android native interface specifically include:
and self-defining the QT interface and the Android native interface into an up-down layout mode, a left-right layout mode or a mode that the QT interface covers the Android native interface.
4. The method of claim 1, wherein the overall Layout of the application is managed by an Android window management system, the QT interface is displayed as a sub-Layout on the Surface, and windows and controls inside the QT interface are managed by the QT window management system.
5. The method of claim 1, wherein the QT interface is used to display 3D vehicle information and the Android native interface is used to display map navigation information.
6. The utility model provides an implementation system that Android is native and QT mix development which characterized in that includes: an Android native development framework and a QT framework;
the Android native development framework is used for creating at least one Activity of an application, setting Layout files in a user-defined mode based on the size and position relation of a QT interface and an Android native interface displayed in the same Activity, and dividing the overall Layout into a sub-Layout to which the QT interface belongs and other sub-layouts Layout layouts; and associating the Surface of the QT to the Layout corresponding to the QT interface corresponding to the Activity;
the QT framework is used for creating a Surface based on an Android system environment and attaching the created Surface to a sub-Layout to which a QT interface belongs; and for developing at least one QT interface and displaying at least one of the QT interfaces onto a Surface;
when the application is started, firstly starting the Activity corresponding to the application on the Android native development frame side;
loading the layout file corresponding to the Activity, and starting a QT framework;
initializing a QT window management system on the QT frame side;
creating a Surface by a QT frame based on an Android system environment;
acquiring a sublevel Layout to which a QT interface belongs;
adding the created Surface to the Layout to which the QT interface belongs;
and displaying the QT interface on the Surface, and simultaneously displaying the Android native interface on other sub-Layout to realize the same-screen display of the QT interface and the Android native interface.
7. The system of claim 6, wherein the entire Layout of the application, Layout, is managed by an Android window management system, and the QT interface is displayed as a sub-Layout on the surface and windows and controls inside the QT interface are managed by the QT window management system.
CN202110247533.XA 2021-03-06 2021-03-06 Implementation method and system for Android native and QT mixed development Active CN112882706B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110247533.XA CN112882706B (en) 2021-03-06 2021-03-06 Implementation method and system for Android native and QT mixed development

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110247533.XA CN112882706B (en) 2021-03-06 2021-03-06 Implementation method and system for Android native and QT mixed development

Publications (2)

Publication Number Publication Date
CN112882706A CN112882706A (en) 2021-06-01
CN112882706B true CN112882706B (en) 2022-03-25

Family

ID=76055643

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110247533.XA Active CN112882706B (en) 2021-03-06 2021-03-06 Implementation method and system for Android native and QT mixed development

Country Status (1)

Country Link
CN (1) CN112882706B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102866890A (en) * 2012-09-11 2013-01-09 哈尔滨商业大学 System and method for generating Android embedded interface and program framework based on object correlation
CN105487869A (en) * 2015-11-30 2016-04-13 深圳联友科技有限公司 Vehicular double-system device and starting method thereof
CN110866991A (en) * 2019-12-11 2020-03-06 北京工业大学 Marine inspection supervisory systems based on unmanned aerial vehicle takes photo by plane

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200387930A1 (en) * 2017-04-20 2020-12-10 Eat Displays Pty Limited Display device and content display system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102866890A (en) * 2012-09-11 2013-01-09 哈尔滨商业大学 System and method for generating Android embedded interface and program framework based on object correlation
CN105487869A (en) * 2015-11-30 2016-04-13 深圳联友科技有限公司 Vehicular double-system device and starting method thereof
CN110866991A (en) * 2019-12-11 2020-03-06 北京工业大学 Marine inspection supervisory systems based on unmanned aerial vehicle takes photo by plane

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于Qt Quick的跨平台移动应用开发关键技术研究;郑纯军等;《软件工程师》;20150430(第04期);33-35 *
基于Qt的Android应用程序C/C++开发方法与实践;闫锋欣等;《计算机系统应用》;20180715(第07期);96-102 *

Also Published As

Publication number Publication date
CN112882706A (en) 2021-06-01

Similar Documents

Publication Publication Date Title
US9002574B2 (en) Mobile integration platform (MIP) integrated handset application proxy (HAP)
KR101228708B1 (en) System for providing transparent access to hardware graphic layers
EP2466262B1 (en) Electronic apparatus
CN105653336A (en) Method for integrating application under double operating systems
CN110888615A (en) Multi-input equipment interaction method, device and medium for double-screen different display of Android system
CN109491624A (en) Multi-screen control method and device, storage medium and the vehicle device of onboard system
JP2005512887A (en) Method and apparatus for displaying information and vehicle infotainment system
CN109117060B (en) Pull-down notification bar display method, device, terminal and storage medium
CN109649276B (en) Vehicle windshield based on transparent liquid crystal display screen and interaction method thereof
US10455000B2 (en) Method for executing remote application in local device
EP3944068A2 (en) Method, apparatus and system for voice interaction, vehicles and storage media
CN107291319A (en) A kind of window display method, information interacting method and system
CN112882706B (en) Implementation method and system for Android native and QT mixed development
US20170185422A1 (en) Method and system for generating and controlling composite user interface control
CN106648602B (en) Page loading method
KR100695080B1 (en) Mobile Communication Terminal Having Screen Splitting Function
CN105711523A (en) Vehicle-mounted intelligent terminal, system and information sharing method
CN104915168A (en) Information processing method and electronic device
CN110708591B (en) Image processing method and device and electronic equipment
CN114416231A (en) Virtual split screen display method and virtual split screen and screen combination switching method for vehicle-mounted entertainment system
CN113504870A (en) Hypervisor intelligent cockpit input method sharing system and method
CN110992859B (en) Advertising board display method and device based on AR guide
CN103597435A (en) Method and apparatus for object-based transition effects for a user interface
CN115619911B (en) Virtual image generation method based on Unreal Engine
CN107229479A (en) Novel on-vehicle system framework

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant