JNI/NDK Development Guide (iii) -- ing between JNI data types and Java data types, ndkjni
Reprinted please indicate the source: http://blog.csdn.net/xyang81/article/details/42047899
When we call a Java native method, how does the parameter in the method pass to the local function in C/C ++? How are the parameters in the Java method converted from those in the C/C ++ function? I guess you should have relat
-shaped data type of its own initiative to convert to C /c++ the corresponding data type, so we are writing the JNI program. It is necessary to identify the correspondence between their data types. The data types in the Java language are divided into basic data types and reference types. There are 8 basic data types: Byte, char, short, int, long, float, double, Boolean. Other than the base data type are reference types: Object, String, array, and so o
generally composed of two parts: a method parameter and a return type. The method parameters are in brackets and the return type is behind them,
For example
() V returns void with no parameter.
(DFZ [c) I returns int, and the parameters are double, float, and char []
(Ljava/lang/string;) ljava/lang/string; return string, the parameter is string
If you do not know the meaning of the characters, you cannot understand the meaning. The chara
1. What is JNI?Java Native Interface (Java Native Interface)For example, method declaration:Public final native classThe method above does not have a method body, but it is not an abstract method, it is a concrete method, because it adds native modification, which means that this method is implemented using the underlying C.Java provides JNI as an interface speci
Chap1:jni Complete Manual ... 3
chap2:jni-Baidu Encyclopedia ... 11
Chap 3:javah command Help information ... 16
Chap 4: Generate an. h file with a javah ... 17
Chap5:jni Tutorial (very very good) 19
Chap6:jni pass-through return value ... 26
15.2.2.3 Pass String ... 28
15.2.2.4 Pass int array ... 29
15.2.2.5 passing a
Getting started with JNI-learning notes and getting started with jniGetting started with JNI-learning notes
Executable File Windows -*. exe | linux -*. elfc function library file Windows -*. dll | linux -*. so batch file Windows -*. bat | linux -*. shTools
NDK -- native developer kits
Cygwin-Linux System Simulator
Installation Process key points: -- can be installed online during installation or through a
JNI, a technique used to develop a local C function library. A bridge for linking Java and C or C + + languages. In the development of some Android projects, we need to use this technology. Then the nonsense is not much to say, get into the chase.Development of JNI, need to use the NDK, this everyone should know. A Linux development environment is also required. In general, you can use a virtual machine to
object to be garbage collected.4 Not all references can be used in all contexts. For example, it is illegal to use a local reference after a create return reference native method.
So what exactly is a local reference, what is the global reference, and what are their differences?
Local reference
Most JNI functions create local references. For example, the
Code Download: http://dl.dbank.com/c0c0xs3b24
One, JNI implementation callback
The method of invoking the Java layer at the native level through JNI enables the native layer to deliver messages to the Java layer.
Jnicallback.java
public class Jnicallback extends activity {
static {
system.loadlibrary ("callback");
}
public void callback (int notify_id, int param)
{
log.e ("Jnicallback",
Preliminary understanding of JNI
What is JNI? JNI is the abbreviation of Java Native Interface. Java Native Interface (JNI) standard has become part of the Java platform since Java 1.1.CodeInteract with code written in other languages. JNI was initially designed for local
. It contains the jobject passed in when the function is called and the jobject created in the JNI layer function, the biggest feature is that once the JNI layer function returns, these jobject may be reclaimed. Global Refrence: Global reference. This type of reference will remain in the memory if the program does not actively call the destroy interface. Weak Global Refrence: Weak Global reference, which ma
From: http://chnic.iteye.com/blog/198745Busy for a long time, finally got a few days of free. Seemingly a long time did not update the blog, is really a sin. In fact, have been trying to put the relevant things jni, starting from today. Here we go.JNI is actually the abbreviation for Java Native Interface , which is the Java local interface. It provides a number of APIs that enable communication with Java and other languages (mainly cc++). Maybe a lot
Book: JNI technology BASICS (1) -- writing JNI code from scratch
2. Compile the source program helloworld. Java and generate helloworld. Class.
3. Generate the header file helloworld. h
On the Linux console, enter the command javah-JNI helloworld to generate the helloworld. h header file.
//HelloWorld.h/* DO NOT EDIT THIS FILE - it is machine generated */#inc
Transferred from: http://chnic.iteye.com/blog/198745Busy for a long time, finally got a few days of free. Seemingly a long time did not update the blog, is really a sin. In fact, have been trying to put the relevant things jni, starting from today. Here we go.JNI is actually the abbreviation for Java Native interface, which is the Java local interface. It provides a number of APIs that enable communication with Java and other languages (mainly cc++).
Analysis of JNI function registration process, analysis of jni Function
When we call Native code in java, it is generally implemented through JNI. We only need to load local data in the java class. the so library file, declare the native method, and then call the method where it needs to be called. The specific implementation of the native method in java is hande
the native function is to search for the corresponding JNI layer function according to the name, which affects the efficiency. So here is only a detailed explanation of the dynamic registration, Java native and jni through the structure of Jninativemethod to establish a link, the structure of the following:typedef struce { const char* name; The name of the native function in Java, without carr
++ ++
This article is original on this site. You are welcome to repost it! Reprinted please indicate the source:
Http://blog.csdn.net/mr_raptor/article/details/7401178
++ ++
Create a Java object in local C code
The object used to create the Java domain is to create an instance of the Java class and then call the construction method of the Java class.
Taking the construction of Bitmap as an example, bitmap does not have the code created by Java object
1. Development Environment Configuration
As we all know, it is difficult to start with everything. configuring a development environment is the most basic and necessary step for all development projects.
All software and development platforms used: win7 + netbeans + VMware + Ubuntu + ndk + Android SDK
First of all, in win7 platform to configure the development of Android environment, detailed reference blog: http://blog.csdn.net/tianshuai11/article/details/7367700
Then download the android-ndk-r
Copyright notice: This article from Administration Blog, reproduced please indicate the source: http://blog.csdn.net/a_zhon/.Directory (?) [+]1. A brief introduction to the NDK and JNI
NDK:NDK is the abbreviation for Native Development Kit, a set of tools provided by Google that allows you to develop JNI for Android in other languages (c, C + +, or assembler). The NDK can compile multi-platform so,
In the previous article "one of Android JNI development Beginners", I introduced how the Android Application (APK) calls the sharing library implemented by native C through JNI. This article will further introduce the Android Application calling native through JNIC ++ implements a shared library, and implements a helloworld application with the same functions as the previous one in Android
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.