Problems with QT learning record 1-QT C + + call Java

Source: Internet
Author: User

Recently the company mobile development classmate walked, temporary spur looked under.

Android development of Java will not, iOS OC also did not really play, the previous C + + is relatively familiar, see the recent QT even out of two versions 5.4,5.5, seems to be good, looked at the next.


QT Support cross-platform, not much to say, originally looked at this feature to play.

First play Qt for andriod, some native things or rely on Android itself, that requires Java, so first play the next C + + call Java

The return value is always incorrect when you encounter a problem. The specific question is said below.


1. Using JNI technology, the use of encapsulated qandroidjniobject is very convenient, no traditional JNI, after all, has been encapsulated a lot simpler.

But it also brings a problem, the call fails, no exception is thrown, and there is no specific way to get the appropriate error message. The original JNI seems to take exception information through Env. If you know a spectator, you will hear it.

2. Call static methods have Callstaticmethod and Callstaticobjectmethod, the previous return value is a standard type, available template parameters
The second one for the return value is the object. The return standard type is easy to succeed, with little chance of error.
3. Call instance methods have Callmethod and Callobjectmethod, the difference is similar
4. The return value parameter is shown in the Help document.
A point that is prone to problems,
Object definition last semicolon (Callstaticmethod and callmethod not required)
[For array objects, not arrays do not add"Just because it didn't pay attention to wasting a day."


Object Types

Type Signature
Jobject l<fully-qualified-name>;
Jclass
Jstring
Jobjectarray [l<fully-qualified-name>;
Jarray [<type>
Jbooleanarray [Z
Jbytearray [B
Jchararray [C
Jshortarray [S
Jintarray [I
Jlongarray [J
Jfloatarray [F
Jdoublearray [D
Primitive Types


Type Signature
Jboolean Z
Jbyte B
Jchar C
Jshort S
Jint I
Jlong J
Jfloat F
Jdouble D
Other


Type Signature
void V


-----

Just say the questions and points, simple point, the main is to record their own. The spectators forgive me

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Problems with QT learning record 1-QT C + + call Java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.