pub struct NativeActivity { /* private fields */ }
Expand description
An ANativeActivity *
This is either provided in ANativeActivity_onCreate
, or accessible in
android_native_app_glue
’s android_app.
Implementations§
Source§impl NativeActivity
impl NativeActivity
Sourcepub unsafe fn from_ptr(ptr: NonNull<ANativeActivity>) -> Self
pub unsafe fn from_ptr(ptr: NonNull<ANativeActivity>) -> Self
Create a NativeActivity
from a pointer
By calling this function, you assert that it is a valid pointer to a native
ANativeActivity
.
Sourcepub fn ptr(&self) -> NonNull<ANativeActivity>
pub fn ptr(&self) -> NonNull<ANativeActivity>
The pointer to the native ANativeActivity
Source§impl NativeActivity
Methods that relate to fields of the struct itself
impl NativeActivity
Methods that relate to fields of the struct itself
The relevant NDK docs can be found here.
Sourcepub fn sdk_version(&self) -> i32
pub fn sdk_version(&self) -> i32
The platform’s SDK version code
Sourcepub fn internal_data_path(&self) -> &CStr
pub fn internal_data_path(&self) -> &CStr
Path to this application’s internal data directory
Sourcepub fn external_data_path(&self) -> &CStr
pub fn external_data_path(&self) -> &CStr
Path to this application’s external (removable, mountable) data directory
Sourcepub fn asset_manager(&self) -> AssetManager
pub fn asset_manager(&self) -> AssetManager
This app’s asset manager, which can be used to access assets from the .apk
file.
Sourcepub unsafe fn set_instance(&mut self, data: *mut c_void)
pub unsafe fn set_instance(&mut self, data: *mut c_void)
Set the instance data associated with the activity
This can invalidate assumptions held by android_native_app_glue
, as well as cause data
races with concurrent access to the instance data.
Sourcepub fn vm(&self) -> JavaVM
pub fn vm(&self) -> JavaVM
This process’s JavaVM
object.
let vm = native_activity.vm();
let env = vm.attach_current_thread();
// Do JNI with env ...
Source§impl NativeActivity
Methods that relate to ANativeActivity_*
functions.
impl NativeActivity
Methods that relate to ANativeActivity_*
functions.
The relevant NDK docs can be found here.
Sourcepub fn show_soft_input(&self, force: bool)
pub fn show_soft_input(&self, force: bool)
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.
Sourcepub fn hide_soft_input(&self, not_always: bool)
pub fn hide_soft_input(&self, not_always: bool)
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.
Trait Implementations§
Source§impl Debug for NativeActivity
impl Debug for NativeActivity
impl Send for NativeActivity
impl Sync for NativeActivity
Auto Trait Implementations§
impl Freeze for NativeActivity
impl RefUnwindSafe for NativeActivity
impl Unpin for NativeActivity
impl UnwindSafe for NativeActivity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more