org.appcelerator.titanium
Class TiApplication

java.lang.Object
  extended by android.content.Context
      extended by android.content.ContextWrapper
          extended by android.app.Application
              extended by org.appcelerator.titanium.TiApplication
All Implemented Interfaces:
ComponentCallbacks, Handler.Callback, org.appcelerator.kroll.KrollApplication

public abstract class TiApplication
extends Application
implements Handler.Callback, org.appcelerator.kroll.KrollApplication

The main application entry point for all Titanium applications and services.


Method Summary
static Activity getAppCurrentActivity()
          This is a convenience method to avoid having to check TiApplication.getInstance() is not null every time we need to grab the current activity.
 TiProperties getAppProperties()
           
static Activity getAppRootOrCurrentActivity()
          This is a convenience method to avoid having to check TiApplication.getInstance() is not null every time we need to grab the root or current activity.
 Activity getCurrentActivity()
           
static TiApplication getInstance()
          Retrieves the instance of TiApplication.
static boolean isUIThread()
           
 

Method Detail

getInstance

public static TiApplication getInstance()
Retrieves the instance of TiApplication. There is one instance per Android application.

Returns:
the instance of TiApplication.

getAppCurrentActivity

public static Activity getAppCurrentActivity()
This is a convenience method to avoid having to check TiApplication.getInstance() is not null every time we need to grab the current activity.

Returns:
the current activity

getAppRootOrCurrentActivity

public static Activity getAppRootOrCurrentActivity()
This is a convenience method to avoid having to check TiApplication.getInstance() is not null every time we need to grab the root or current activity.

Returns:
root activity if exists. If root activity doesn't exist, returns current activity if exists. Otherwise returns null.

getCurrentActivity

public Activity getCurrentActivity()
Returns:
the current activity if exists. Otherwise, the thread will wait for a valid activity to be visible.

getAppProperties

public TiProperties getAppProperties()
Returns:
the app's properties, which are listed in tiapp.xml. App properties can also be set at runtime by the application in Javascript.

isUIThread

public static boolean isUIThread()
Returns:
true if the current thread is the main thread, false otherwise.


Copyright © 2010-2012 Appcelerator, Inc. Licensed under the Apache License 2.0