android_intent/
lib.rs

1mod action;
2pub use action::Action;
3
4mod extra;
5pub use extra::Extra;
6
7mod intent;
8pub use intent::Intent;
9use jni::{JNIEnv, JavaVM};
10
11/// Run 'f' with the current [`JNIEnv`] from [`ndk_context`].
12pub fn with_current_env(f: impl FnOnce(JNIEnv)) {
13    let cx = ndk_context::android_context();
14    let vm = unsafe { JavaVM::from_raw(cx.vm().cast()) }.unwrap();
15    let env = vm.attach_current_thread().unwrap();
16
17    f(env.clone());
18}