Titanium.Android.Activity

Object of Titanium.Android.
Platform Since
Android 1.5

Summary

The Titanium binding of an Android Activity

Code Examples

Callback example

activity.startActivityForResult(intent, function(e) {
    // The request code used to start this Activity
    var requestCode = e.requestCode;
    // The result code returned from the Activity (http://developer.android.com/reference/android/app/Activity.html#StartingActivities)
    var resultCode = e.resultCode;
    // A Titanium.Android.Intent filled with data returned from the Activity
    var intent = e.intent;
    // The Activity the received the result
    var source = e.source;
});

Methods

Name Summary
addEventListener

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

finish

Called when the activity is done and should be closed. Also see Android's documentation for finish

fireEvent

Fires a synthesized event to any registered listeners.

getIntent

Gets the value of the intent property.

getString

Get an Android or Application string using the passed-in Resource ID and optional format arguments. Also see Android's documentation for getString and String Resources

removeEventListener

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

setRequestedOrientation

Set the requested Activity orientation. Also see Android's documentation for setRequestedOrientation

setResult

Sets the result of this Activity using an Intent. This should be used in the case when the Activity responds to startActivityForResult. Also see Android's documentation for setResult

startActivity

Starts a new Activity, using the passed in Intent as the description. Also see Android's documentation for startActivity

startActivityForResult

The same as startActivity, but also accepts a callback function for handling the result of the started Activity. Also see Android's documentation for startActivityForResult

Properties

Name Type Summary
intent Titanium.Android.Intent

The Titanium.Android.Intent that was used to start this Activity read-only

onCreateOptionsMenu Callback<Object>

A callback function that is called to initially create an Android Options Menu for this Activity when the user presses the Menu button. See the menu examples in Titanium.Android.Menu

onPrepareOptionsMenu Callback<Object>

A callback function that is called to prepare an Options Menu for displaying on this Activity when the user presses the Menu button. See the menu examples in Titanium.Android.Menu

requestedOrientation Number

Can be one of Titanium.Android.SCREEN_ORIENTATION_BEHIND, Titanium.Android.SCREEN_ORIENTATION_LANDSCAPE, Titanium.Android.SCREEN_ORIENTATION_NOSENSOR, Titanium.Android.SCREEN_ORIENTATION_PORTRAIT, Titanium.Android.SCREEN_ORIENTATION_SENSOR, Titanium.Android.SCREEN_ORIENTATION_UNSPECIFIED, Titanium.Android.SCREEN_ORIENTATION_USER write-only

Events

Name Summary
create

Fired from the Activity's onCreate

destroy

Fired from the Activity's onDestroy

newIntent

Fired when the application is already running and certain flags are set in the Intent. Fired from the Activity's onNewIntent

pause

Fired from the Activity's onPause

resume

Fired from the Activity's onResume

start

Fired from the Activity's onStart

stop

Fired from the Activity's onStop