event-types

command
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Example: input event type system and processing pattern.

Prints all enum types in the ndk/input package -- event types, key actions, input sources, and motion actions -- together with their integer values and human-readable string representations. This demonstrates the full set of constants that classify input events on Android.

Input events flow through the system in four steps:

  1. The Activity receives an AInputQueue from the framework.
  2. The Queue is polled for pending events (Queue.HasEvents).
  3. Each Event is inspected: Event.Type tells you whether it is a Key or Motion event, and the remaining accessors (KeyAction, KeyCode, MotionAction, X, Y, Pressure, etc.) provide the details.
  4. After processing, the event must be returned to the system with Queue.FinishEvent so Android knows whether the app handled it.

Actually receiving events requires an AInputQueue obtained from an Android Activity, so this example focuses on the type system and documents the processing pattern in code comments.

This program must run on an Android device.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL