Skip to content

Update examples#245

Merged
rib merged 1 commit intomainfrom
rib/pr/update-examples
Mar 23, 2026
Merged

Update examples#245
rib merged 1 commit intomainfrom
rib/pr/update-examples

Conversation

@rib
Copy link
Copy Markdown
Member

@rib rib commented Mar 23, 2026

This updates both the examples to Gradle 9 and AGP 9.1

The examples are identical, except that na-mainloop is based on NativeActivity and the agdk-mainloop based on GameActivity.

The examples demonstrate:

  • Using the jni API to define enough bindings to be able to send a Toast
  • Using an android_on_create entry point for logging initialization and JNI initialization
  • Using AndroidApp::run_on_java_main_thread() to send a toast from the Java main / UI thread
  • Running an android_main event loop, including printing historic pointer samples (a new 0.6.1 feature)

The examples support two input actions:

  • Lifting your finger in the top-left corner of the screen will show the onscreen keyboard
  • Lifting your finger in the top-right corner of the screen will hide the onscreen keyboard

If you edit and disable configChanges in AndroidManifest.xml then these examples can also demonstrate that android-activity gracefully handles repeated Activity create -> run -> destroy cycles.

@rib rib force-pushed the rib/pr/update-examples branch 2 times, most recently from 97efc6d to 7a275f8 Compare March 23, 2026 22:26
This updates both the examples to Gradle 9 and AGP 9.1

The examples are identical, except that `na-mainloop` is based on
NativeActivity and the `agdk-mainloop` based on GameActivity.

The examples demonstrate:
- Using the `jni` API to define enough bindings to be able to send a Toast
- Using an `android_on_create` entry point for logging initialization
  and JNI initialization
- Using `AndroidApp::run_on_java_main_thread()` to send a toast from the
  Java main / UI thread
- Running an `android_main` event loop, including printing historic
  pointer samples (a new 0.6.1 feature)

The examples support two input actions:
- Lifting your finger in the top-left corner of the screen will show the
  onscreen keyboard
- Lifting your finger in the top-right corner of the screen will hide
  the onscreen keyboard

If you edit and disable `configChanges` in `AndroidManifest.xml` then
these examples can also demonstrate that `android-activity` gracefully
handles repeated `Activity` create -> run -> destroy cycles.
@rib rib force-pushed the rib/pr/update-examples branch from 7a275f8 to 600ca07 Compare March 23, 2026 22:26
@rib rib merged commit 57b5192 into main Mar 23, 2026
7 checks passed
@rib rib deleted the rib/pr/update-examples branch March 23, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant