org.appcelerator.titanium.util
Class TiRHelper

java.lang.Object
  extended by org.appcelerator.titanium.util.TiRHelper

public class TiRHelper
extends Object

This class allows us to retrieve Android resource IDs from the various Android R classes using strings at runtime.


Nested Class Summary
static class TiRHelper.ResourceNotFoundException
          The exception thrown by TiRHelper when a particular resource is not found.
 
Method Summary
static int getResource(String path)
          Searches for an Android compiled resource given its path.
static int getResource(String path, boolean includeSystemResources)
          Searches for an Android compiled resource given its path.
 

Method Detail

getResource

public static int getResource(String path,
                              boolean includeSystemResources)
                       throws TiRHelper.ResourceNotFoundException
Searches for an Android compiled resource given its path. These resources are traditionally accessed via a resource ID (either from the application's resource bundle, or Android's internal resource bundle)

Parameters:
path - the resource's path.
includeSystemResources - indicates whether or not getResource(String, boolean) will look in the system's (Android) resource bundle, if the resource is not found in the application's resource bundle.
Returns:
the resource, if found.
Throws:
TiRHelper.ResourceNotFoundException - the exception thrown when the resource is not found in either location listed above.

getResource

public static int getResource(String path)
                       throws TiRHelper.ResourceNotFoundException
Searches for an Android compiled resource given its path. Refer to getResource(String, boolean) for more details.

Parameters:
path - the resource's path
Returns:
the resource, if found.
Throws:
TiRHelper.ResourceNotFoundException - the exception thrown when the resource is not found in either the application's resource bundle, or Android's internal resource bundle.


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