Struct android_intent::Intent

source ·
pub struct Intent<'env> {
    pub env: JNIEnv<'env>,
    pub object: JObject<'env>,
}
Expand description

A messaging object you can use to request an action from another android app component.

Fields§

§env: JNIEnv<'env>§object: JObject<'env>

Implementations§

source§

impl<'env> Intent<'env>

source

pub fn from_object(env: JNIEnv<'env>, object: JObject<'env>) -> Self

source

pub fn new(env: JNIEnv<'env>, action: impl AsRef<str>) -> Self

source

pub fn new_with_uri(
env: JNIEnv<'env>,
action: impl AsRef<str>,
uri: impl AsRef<str>
) -> Self

source

pub fn push_extra(&self, key: impl AsRef<str>, value: impl AsRef<str>)

Add extended data to the intent.

use android_intent::{Action, Extra, Intent};

let intent = Intent::new(env, Action::Send);
intent.push_extra(Extra::Text, "Hello World!")
source

pub fn with_extra(&self, key: impl AsRef<str>, value: impl AsRef<str>) -> &Self

source

pub fn create_chooser(&self) -> Self

Builds a new Action::Chooser Intent that wraps the given target intent.

use android_intent::{Action, Intent};

let intent = Intent::new(env, Action::Send);
let chooser_intent = intent.create_chooser();
source

pub fn create_chooser_with_title(&self, title: Option<impl AsRef<str>>) -> Self

source

pub fn set_type(&self, type_name: impl AsRef<str>)

Set an explicit MIME data type.

use android_intent::{Action, Intent};

let intent = Intent::new(env, Action::Send);
intent.set_type("text/plain");
source

pub fn with_type(&self, type_name: impl AsRef<str>) -> &Self

source

pub fn start_activity(&self)

Auto Trait Implementations§

§

impl<'env> RefUnwindSafe for Intent<'env>

§

impl<'env> !Send for Intent<'env>

§

impl<'env> !Sync for Intent<'env>

§

impl<'env> Unpin for Intent<'env>

§

impl<'env> UnwindSafe for Intent<'env>

Blanket Implementations§

source§

impl<T> Any for Twhere
T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<'a, T> Desc<'a, T> for T

source§

fn lookup(self, _: &JNIEnv<'a>) -> Result<T, Error>

Look up the concrete type from the JVM.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere
U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.