Titanium.Android.Intent

Object of Titanium.Android.
Platform Since
Android 1.5

Summary

The Titanium binding of an Android Intent

Code Examples

Create an Intent for Launching an Activity

var intent = Ti.Android.createIntent({
    action: Ti.Android.ACTION_MAIN,
    url: 'activity1.js'
});
intent.addCategory(Ti.Android.CATEGORY_LAUNCHER);
Ti.Android.currentActivity.startActivity(intent);

Create an Intent to get a Contact URI from the user's contacts

var intent = Ti.Android.createIntent({
    action: Ti.Android.ACTION_GET_CONTENT,
    type: "vnd.android.cursor.item/phone"
});

Pick a Photo from the Photo Gallery

var intent = Ti.Android.createIntent({
    action: Ti.Android.ACTION_PICK,
    type: "image/*"
});
intent.addCategory(Ti.Android.CATEGORY_DEFAULT);

Methods

Name Summary
addCategory

Add a category to this Intent. See the category constants in Titanium.Android.

addEventListener

Adds the specified callback as an event listener for the named event.

addFlags

augment the existing flags on the Intent.

fireEvent

Fires a synthesized event to any registered listeners.

getBooleanExtra

Get a boolean property from this Intent

getData

Get the Data URI from this Intent

getDoubleExtra

Get a double property from this Intent

getIntExtra

Get a int property from this Intent

getLongExtra

Get a long property from this Intent

getStringExtra

Get a string property from this Intent

hasExtra

Returns whether or not this Intent has a property

putExtra

Put an extra property on this Intent

putExtraUri

Put a URI property on this Intent (useful for Titanium.Android.EXTRA_STREAM)

removeEventListener

Removes the specified callback as an event listener for the named event.

Properties

Name Type Summary
action String

An action constant from Titanium.Android creation

className String

The Java class name of the activity (packageName must also be set) creation

data String

The Intent's Data URI. See also Android's Intent.setData read-only

flags Number

Intent flags. See the flags constants in Titanium.Android.

packageName String

The fully-qualified Java package name of the activity creation

type String

The mime type for this Intent. See also Android's Intent.setType creation

url String

The URL to a Titanium Javascript Activity creation

Events

This type has no events.