The Sequoyah Android feature lets you generate C++ classes from native method declarations in your Java
source files. This allows you to focus on the native function implementations, rather than the mechanics of
parameter passing between Java and native C/C++ code.
Before you can generate native classes from the Java declarations, you must have added native support to your
Android project. You must also have one or more native function declarations in your Java source code. For
example:
private static native void myNativeFunction(int myParam);
Note: The Sequoyah Android feature includes Content Assist templates for native function declaration ("native
lib") and native library loading ("load native lib"). See the "Templates" topic in the C/C++ Development User
Guide (in the online help) for more information on using Content Assist.
-
Right-click the Java source file containing the native declarations and select
You will be prompted for the directory in which the C++ files should be created. By default, this is
your project's .jni directory.
-
Select the directory in which the C++ files should be created, and click OK.
C++ files containing basic functions corresponding to the native declarations are generated and stored in
the specified directory. Edit these source files--typically using the C/C++ perspective--and supply
implementations for each of the generated function bodies.
If you re-generate C++ files for a given Java class--because you have added additional native declarations,
perhaps--a new version of each native function will be added to the existing C++ source file, but the existing
versions will not be deleted. You will need to delete any unneeded duplicate function definitions
manually.