Creating a native activity with the native_activity.h interface
The Android native application API allows us to create a native activity, which makes writing Android apps in pure native code possible. This recipe introduces how to write a simple Android application with pure C/C++ code.
Getting ready
Readers are expected to have basic understanding of how to invoke JNI functions. Chapter 2, Java Native Interface, covers JNI in detail and readers are recommended to read the chapter or at least the following recipes before going through the current one:
Manipulating strings in Android NDK
Calling instance and static methods in NDK
How to do it…
The following steps to create a simple Android NDK application without a single line of Java code:
Create an Android application named
NativeActivityOne
. Set the package name ascookbook.chapter5.nativeactivityone
. Please refer to the Loading native libraries and registering native methods recipe of Chapter 2, Java Native Interface, if you want more detailed...