Titanium.App.Android

Submodule of Titanium.App.
Platform Since
Android 1.5

Summary

A module used to access the Android's Application Resources

Code Examples

Custom String Resource

In Titanium, you can specify custom Android resources by placing them in platform/android under the top directory of your project. For example, to create a custom strings.xml, You could create and populate platform/android/res/values/mystrings.xml with the following data:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="mystring">testing 1 2 3</string>
</resources>

And in Javascript, you could retrieve like this:

var activity = Ti.Android.currentActivity;
var R = Ti.App.Android.R;
 
var mystring = activity.getString(R.string.mystring);
Ti.API.debug("mystring="+mystring);

Objects

Name Summary
Titanium.App.Android.R

The Titanium binding of Application Resources. This gives you access to resources you have packaged for your own application. If you want to access the system-wide Android R, use Titanium.Android.R.

Methods

Name Summary
addEventListener

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

fireEvent

Fires a synthesized event to any registered listeners.

removeEventListener

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

Properties

Name Type Summary
R Titanium.App.Android.R

The R namespace for Application Resources read-only

Events

This type has no events.