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.

getAction

Gets the value of the action property.

getBooleanExtra

Get a boolean property from this Intent

getClassName

Gets the value of the className property.

getData

Get the Data URI from this Intent

getDoubleExtra

Get a double property from this Intent

getFlags

Gets the value of the flags property.

getIntExtra

Get a int property from this Intent

getLongExtra

Get a long property from this Intent

getPackageName

Gets the value of the packageName property.

getStringExtra

Get a string property from this Intent

getType

Gets the value of the type property.

getUrl

Gets the value of the url property.

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.

setFlags

Sets the value of the flags property.

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.