1313//! a wider range of devices.
1414//!
1515//! Standalone applications based on this crate need to be built as `cdylib` libraries, like:
16- //! ```
16+ //! ```toml
1717//! [lib]
1818//! crate_type=["cdylib"]
1919//! ```
2020//!
2121//! and implement a `#[no_mangle]` `android_main` entry point like this:
22- //! ```rust
22+ //! ```
2323//! #[no_mangle]
24- //! fn android_main(app: AndroidApp) {
24+ //! fn android_main(app: android_activity:: AndroidApp) {
2525//!
2626//! }
2727//! ```
6464//! These are undone after `android_main()` returns
6565//!
6666//! # Android Extensible Enums
67+ // TODO: Move this to the NDK crate, which now implements this for most of the code?
6768//!
6869//! There are numerous enums in the `android-activity` API which are effectively
6970//! bindings to enums declared in the Android SDK which need to be considered
9596//! For example, here is how you could ensure forwards compatibility with both
9697//! compile-time and runtime extensions of a `SomeEnum` enum:
9798//!
98- //! ```rust
99+ //! ```ignore
99100//! match some_enum {
100101//! SomeEnum::Foo => {},
101102//! SomeEnum::Bar => {},
@@ -126,7 +127,7 @@ use ndk::native_window::NativeWindow;
126127
127128use bitflags:: bitflags;
128129
129- #[ cfg( not( target_os = "android" ) ) ]
130+ #[ cfg( all ( not( target_os = "android" ) , not ( feature = "test" ) ) ) ]
130131compile_error ! ( "android-activity only supports compiling for Android" ) ;
131132
132133#[ cfg( all( feature = "game-activity" , feature = "native-activity" ) ) ]
@@ -550,10 +551,10 @@ impl AndroidApp {
550551 /// between native Rust code and Java/Kotlin code running within the JVM.
551552 ///
552553 /// If you use the [`jni`] crate you can wrap this as a [`JavaVM`] via:
553- /// ```ignore
554+ /// ```no_run
554555 /// # use jni::JavaVM;
555- /// # let app: AndroidApp = todo!();
556- /// let vm = unsafe { JavaVM::from_raw(app.vm_as_ptr()) };
556+ /// # let app: android_activity:: AndroidApp = todo!();
557+ /// let vm = unsafe { JavaVM::from_raw(app.vm_as_ptr().ast() ) };
557558 /// ```
558559 ///
559560 /// [`jni`]: https://crates.io/crates/jni
@@ -565,10 +566,10 @@ impl AndroidApp {
565566 /// Returns a JNI object reference for this application's JVM `Activity` as a pointer
566567 ///
567568 /// If you use the [`jni`] crate you can wrap this as an object reference via:
568- /// ```ignore
569+ /// ```no_run
569570 /// # use jni::objects::JObject;
570- /// # let app: AndroidApp = todo!();
571- /// let activity = unsafe { JObject::from_raw(app.activity_as_ptr()) };
571+ /// # let app: android_activity:: AndroidApp = todo!();
572+ /// let activity = unsafe { JObject::from_raw(app.activity_as_ptr().cast() ) };
572573 /// ```
573574 ///
574575 /// # JNI Safety
@@ -725,7 +726,7 @@ impl AndroidApp {
725726 /// # Example
726727 /// Code to iterate all pending input events would look something like this:
727728 ///
728- /// ```rust
729+ /// ```
729730 /// match app.input_events_iter() {
730731 /// Ok(mut iter) => {
731732 /// loop {
@@ -780,7 +781,7 @@ impl AndroidApp {
780781 ///
781782 /// Code to handle unicode character mapping as well as combining dead keys could look some thing like:
782783 ///
783- /// ```rust
784+ /// ```
784785 /// let mut combining_accent = None;
785786 /// // Snip
786787 ///
0 commit comments