Skip to content
Titanium SDK
Version13.1.1

You are reading 13.1.1. See this page in 13.4.1.

Titanium.Android.R

proxyAndroidsince 1.5

Extends Titanium.Proxy

The Titanium binding of the native Android R class, giving access to Android system-wide resources or application resources.

To access system-wide resources your application's resources, use Titanium.Android.R. To access your application's resources, use Titanium.App.Android.R.

These properties and sub-properties correspond directly to the properties of the the android.R class, and should have the same syntax. To retrieve the "OK" string from system resources in Android:

Ti.Android.currentActivity.getString(Ti.Android.R.string.ok);

If the file platform/android/res/drawable/icon.png exists in the project, it can be accessed using its resource name, as follows:

var resid = Titanium.App.Android.R.drawable.icon;

See also: android.R in the Android Developer Reference. For more information, refer to the official documentation on the Android Developer website about accessing application resources.

Starting in Titanium SDK 7.3.0, this API exposes all Android related R classes for the usage in Hyperloop. For example, it can be used to access menu resources as part of native user interfaces, e.g. BottomNavigationView or RecyclerView. See an example in the Hyperloop Sample App for details!

Properties 25

anim

Objectread-only

Animation resources. See R.anim in the Android Developer Reference.

animator

Objectsince 7.3.0read-only

Animator resources. See R.animator in the Android Developer Reference.

apiName

Stringsince Android 3.2.0, iPhone 3.2.0, iPad 3.2.0, macOS 9.2.0read-only

Inherited from Titanium.Proxy

The name of the API that this proxy corresponds to.

array

Objectread-only

Array resources. See R.array in the Android Developer Reference.

attr

Objectread-only

Attribute resources. See R.attr in the Android Developer Reference.

bool

Objectsince 7.3.0read-only

Boolean resources. See R.bool in the Android Developer Reference.

bubbleParent

Booleansince Android 3.0.0, iPhone 3.0.0, iPad 3.0.0, macOS 9.2.0

Inherited from Titanium.Proxy

Indicates if the proxy will bubble an event to its parent.

Default: true

color

Objectread-only

Color resources. See R.color in the Android Developer Reference.

drawable

Objectread-only

Drawable resources. See R.drawable in the Android Developer Reference.

fraction

Objectsince 7.3.0read-only

Fraction resources. See R.fraction in the Android Developer Reference.

id

Objectread-only

ID resources. See R.id in the Android Developer Reference.

integer

Objectread-only

Integer resources. See R.integer in the Android Developer Reference.

interpolator

Objectsince 7.3.0read-only

Interpolator resources. See R.fraction in the Android Developer Reference.

layout

Objectread-only

Layout resources. See R.layout in the Android Developer Reference.

mipmap

Objectsince 7.3.0read-only

Mipmap resources. See R.mipmap in the Android Developer Reference.

plurals

Objectsince 7.3.0read-only

Plurals resources. See R.plurals in the Android Developer Reference.

raw

Objectsince 7.3.0read-only

Raw resources. See R.raw in the Android Developer Reference.

string

Objectread-only

String resources. See R.string in the Android Developer Reference.

style

Objectread-only

Style resources. See R.style in the Android Developer Reference.

transition

Objectsince 7.3.0read-only

Transition resources. See R.transition in the Android Developer Reference.

xml

Objectsince 7.3.0read-only

XML resources. See R.xml in the Android Developer Reference.

Methods 4

Inherited from Titanium.Proxy

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

Parameters
ParametersTypeDescription
nameString

Name of the event.

callbackCallback<Titanium.Event>

Callback function to invoke when the event is fired.

4 fields
bubbles Boolean

True if the event will try to bubble up if possible.

cancelBubble Boolean

Set to true to stop the event from bubbling.

source Object

Source object that fired the event.

type String

Name of the event fired.

Inherited from Titanium.Proxy

Fires a synthesized event to any registered listeners.

Parameters
ParametersTypeDescription
nameString

Name of the event.

event?Dictionary

A dictionary of keys and values to add to the Titanium.Event object sent to the listeners.

Inherited from Titanium.Proxy

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

Parameters
ParametersTypeDescription
nameString

Name of the event.

callbackCallback<Titanium.Event>

Callback function to remove. Must be the same function passed to addEventListener.

4 fields
bubbles Boolean

True if the event will try to bubble up if possible.

cancelBubble Boolean

Set to true to stop the event from bubbling.

source Object

Source object that fired the event.

type String

Name of the event fired.