Creating a native activity with the Android native app glue
The previous recipe described how the interface defined in native_activity.h
allows us to create native activity. However, all the callbacks defined
are invoked with the main UI thread, which means we cannot do heavy processing in the callbacks.
Android SDK provides AsyncTask
, Handler
, Runnable
, Thread
, and so on, to help us handle things in the background and communicate with the main UI thread. Android NDK provides a static library named android_native_app_glue
to help us execute callback functions and handle user inputs in a separate thread. This recipe will discuss the android_native_app_glue
library in detail.
Getting ready
The android_native_app_glue
library is built on top of the ...
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.