Struct ndk::native_activity::NativeActivity [−][src]
pub struct NativeActivity { /* fields omitted */ }
Expand description
An ANativeActivity *
This is either provided in ANativeActivity_onCreate
, or accessible in
android_native_app_glue
’s android_app.
Implementations
Create a NativeActivity
from a pointer
Safety
By calling this function, you assert that it is a valid pointer to a native
ANativeActivity
.
The pointer to the native ANativeActivity
Methods that relate to fields of the struct itself
The relevant NDK docs can be found here.
The platform’s SDK version code
Path to this application’s internal data directory
Path to this application’s external (removable, mountable) data directory
This app’s asset manager, which can be used to access assets from the .apk
file.
Set the instance data associated with the activity
Safety
This can invalidate assumptions held by android_native_app_glue
, as well as cause data
races with concurrent access to the instance data.
This process’s JavaVM
object.
Usage with jni crate:
let vm_ptr = native_activity.vm();
let vm = unsafe { jni::JavaVM::from_raw(vm_ptr) }.unwrap();
let env = vm.attach_current_thread();
// Do JNI with env ...
Usage with jni-glue crate:
let vm_ptr = native_activity.vm();
let vm = unsafe { jni_glue::VM::from_jni_local(&*vm_ptr) };
vm.with_env(|env| {
// Do JNI with env ...
});
The android.app.NativeActivity
instance
In the JNI, this is named clazz
; however, as the docs say, “it should really be named
‘activity’ instead of ‘clazz’, since it’s a reference to the NativeActivity instance”.
Methods that relate to ANativeActivity_*
functions.
The relevant NDK docs can be found here.
Shows the IME (the on-screen keyboard).
If force
is true, the SHOW_FORCED
flag is used; otherwise, the SHOW_IMPLICIT
flag is
used. Depending on the value of this flag, the hide_soft_input
method with behave
differently. See the relevant
javadoc
for more information.
Hides the IME (the on-screen keyboard).
If not_always
is true, the HIDE_NOT_ALWAYS
flag is used; otherwise, the
HIDE_IMPLICIT_ONLY
flag is used. Depending on the value of this flag and the way the IME
was shown, it may or may not be hidden. See the relevant
javadoc
for more information.