Android JNI Introduction Second--java parameter types vs. local parameter types

Source: Internet
Author: User

The previous article introduces the use of JNI in Android using a simple example. This article is based on the understanding that some Java parameter types differ from the local parameter types.

1) The return value in Java is completely corresponding to void in JNI. (just one).

2) basic data types in Java (byte, short, int,long,float,double, boolean,char-8) The corresponding data type in JNI is prefixed with J corresponds to (jbyte, Jshort, Jint,jlong,jfloat,jdouble, Jboolean,jchar).

3) objects in Java, including classes, interfaces, and custom class interfaces defined in the class library, correspond to jobject in Jni .

4) The array of basic data types in Java corresponds to the j<type>array type in JNI. (type is the 8 basic data Types mentioned above)

5) An array of objects in Java corresponds to the jobjectarray type in JNI. ( all objects, interfaces, and arrays are objects in Java)

is a map of the Java data type and the JNI data type in the JNI specification.

The first map for the basic data type:

The second is a map of the reference data type:

/**
* @author Zhang Xingye
* Email: xy-zhang#163.com
* Android Development Advanced Group: 278401545
*
*/

Android JNI Introduction Second--java parameter types vs. local parameter types

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.