-
Book Overview & Buying
-
Table Of Contents
Android Native Development Kit Cookbook
By :
The previous recipe covers how to access Java fields in NDK. Besides fields, a Java class also has methods. This recipe focuses on calling static and instance methods from JNI.
The code examples require a basic understanding of the JNI primitive types, strings, classes, and instance objects. It is better to make sure you have read the following recipes before going through this recipe:
Passing parameters and receiving returns in primitive types
Manipulating strings in JNI
Manipulating classes in JNI
Manipulating objects in JNI
Accessing Java static and instance fields in native code
Readers are also expected to be familiar with Java reflection API.
The following steps can be followed to create a sample Android project that illustrates how to call static and instance methods from the native code:
Create a project named CallingMethods. Set the package name as cookbook.chapter2. Create an activity named CallingMethodsActivity...
Change the font size
Change margin width
Change background colour