Skip to content

Example code for AndroidApp::activity_as_ptr does not compile #182

Open
@rnikander

Description

@rnikander

I'm trying to figure out how to get the native activity in my app code. For example, when I want to get access to my app's internal files directory.

The activity_as_ptr method looks promising, but that code causes an error:

let activity = unsafe { JObject::from_raw(app.activity_as_ptr()) };
error[E0308]: mismatched types
  --> my-app/src/lib.rs:75:47
   |
75 |     let activity = unsafe { JObject::from_raw(app.activity_as_ptr()) };
   |                             ----------------- ^^^^^^^^^^^^^^^^^^^^^ expected `*mut _jobject`, found `*mut c_void`
   |                             |
   |                             arguments to this function are incorrect
   |
   = note: expected raw pointer `*mut _jobject`
              found raw pointer `*mut c_void`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions