Documentation
¶
Overview ¶
NativeActivity lifecycle overview.
Documents the Android NativeActivity lifecycle and the methods provided by the ndk/activity package. NativeActivity is the entry point for purely native Android applications: the system creates an ANativeActivity handle and delivers it to the native code via the ANativeActivity_onCreate callback. All Activity methods require this system-provided handle.
Because the Activity handle is only available inside a running Android NativeActivity process, this example documents the pattern and prints the available constants rather than calling the methods directly.
Lifecycle summary (system-driven):
ANativeActivity_onCreate <- system creates the activity
onStart
onResume
onNativeWindowCreated <- ANativeWindow becomes available
onInputQueueCreated <- AInputQueue becomes available
... application runs ...
onInputQueueDestroyed <- AInputQueue revoked
onNativeWindowDestroyed <- ANativeWindow revoked
onPause
onStop
onDestroy <- activity is torn down
The Activity handle is valid from onCreate through onDestroy. The ANativeWindow and AInputQueue handles are valid only between their respective created/destroyed callback pairs.
This program must run on an Android device.