Detecting and handling input events at Android NDK

Input events are essential for user interaction in Android apps. This recipe discusses how to detect and handle input events in Android NDK.

Getting ready

We will further develop the example in last recipe. Please read the Managing native windows at Android NDK recipe before going through this one.

How to do it…

The following steps create a sample application, which detects and handles input events at the native code:

  1. Create an Android application named NativeInputs. Set the package name as cookbook.chapter5.nativeinputs. Please refer to the Loading native libraries and registering native methods recipe of Chapter 2, Java Native Interface, if you want more detailed instructions.
  2. Right-click on 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.