Passing parameters and receiving returns in primitive types
Java code can pass parameters to native methods and receive the processing results returned. This recipe walks through how to pass parameters and receive returns in primitive types.
Getting ready
You should have built at least one Android application with native code before reading this recipe. If you haven't done so, please read the Writing a Hello NDK program recipe in Chapter 1, Hello NDK first.
How to do it…
The following steps create a sample Android application with native methods receiving input parameters from the Java code and returning the processing result back:
- Create a project named
PassingPrimitive
. Set the package name ascookbook.chapter2
. Create an activity namedPassingPrimitiveActivity ...
Get Android Native Development Kit Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.