danger.app
Class ResourceDatabase

java.lang.Object
  extended by danger.app.ResourceDatabase
All Implemented Interfaces:
AppResources


public abstract class ResourceDatabase
extends Object
implements AppResources

A ResourceDatabase contains an application's resources (menus, dialogs, strings, etc). You can obtain your application's ResourceDatabase by using Application.getResources().

Note about UI resources: For events which are defined as part of the UI resources, the event argument is always the originating UI object. For example, when the user selects a menu item, the resulting event has event arg equal to the menu from which it came.


Field Summary
static int RSRC_ALERT
          Alert resource type.
static int RSRC_BITMAP
          Bitmap resource type.
static int RSRC_BITMAP_ARRAY
          Bitmap array resource type.
static int RSRC_CONTAINER
          Container resource type.
static int RSRC_DIALOG
          Dialog resource type.
static int RSRC_INT
          Integer resource type.
static int RSRC_JAVA
          Java resource type.
static int RSRC_MENU
          Menu resource type.
static int RSRC_RINGTONE_ARRAY
          Ringtone array resource type.
static int RSRC_SCREEN
          Screen resource type.
static int RSRC_SEQUENCE
          Sequence resource type.
static int RSRC_SOUND
          Sound resource type.
static int RSRC_SPLASH_SCREEN
          Splash screen resource type.
static int RSRC_STRING
          String resource type.
static int RSRC_STRING_ARRAY
          String array resource type.
static int RSRC_STRINGTABLE
          String table resource type.
static int RSRC_TEXT_INPUT_ALERT
          Text input alert resource type.
 
Fields inherited from interface danger.app.AppResources
ID_APP_CAPABILITIES, ID_APP_CLASS, ID_APP_FLAGS, ID_APP_NAME, ID_APP_VENDOR, ID_CHOOSER_CATEGORY, ID_LARGE_ICON, ID_LOCALE, ID_MIDLET_DEVICE_NAME, ID_MIDLET_PACKED_DIMENSIONS, ID_MIDLET_TWELVE_PAD, ID_MINI_ICON, ID_SMALL_ICON, ID_SPLASH_SCREEN, ID_SPLASH_SCREEN_RESOURCE
 
Method Summary
 void addMenuItemFromResource(BaseMenu menu, int id, int menuItemID, int eventData, Object eventArg, Listener listener)
          Appends a menu item to an existing menu.
 Container addToContainerFromContainerResource(Container container, int id, Listener listener)
          Adds widgets from a container resource to an existing container.
 Container addToContainerFromContainerResource(Container container, int id, Listener listener, Factory factory)
          Adds widgets from a container resource to an existing container.
 void addToContainerFromDialogResource(Container container, int id, Listener listener)
          Adds widgets from a dialog resource to an existing container.
 void addToMenuFromResource(BaseMenu menu, int id, Listener listener, Window textEditBaseWindow)
          Appends a menu resource to an existing menu.
 InputStream findAbsoluteJavaResource(String name)
          Returns an input stream for the java resource with the specified name.
 AlertWindow getAlert(int id)
          Get the alert with the given ID.
 AlertWindow getAlert(int id, Listener listener)
          Get the alert with the given ID, and set its listener to the given one.
 AlertWindow getAlert(int id, Listener listener, Factory factory)
          Get the alert with the given ID, and set its listener to the given one.
 AnimatedBitmap getAnimatedBitmap(int id, int decodeFlags)
          Obtain a specific animated bitmap resource or null if such a bitmap resource does not exist.
 AnimatedBitmap getAnimatedBitmapFromArray(int id, int index, int decodeFlags)
          Get an animated bitmap from an array.
static String[] getAvailableLocales()
          Returns an array of the locales available on this device.
 Bitmap getBitmap(int id)
          Obtain a specific bitmap resource or null if such a bitmap resource does not exist.
 Bitmap[] getBitmapArray(int id)
          Get the bitmap array with the specified resource id.
 int getBitmapArrayCount(int id)
          Return the number of bitmaps in an array.
 Bitmap getBitmapFromArray(int id, int index)
          Get a bitmap from an array.
 DialogWindow getDialog(int id)
          Get the dialog with the given ID.
 DialogWindow getDialog(int id, Listener listener)
          Get the dialog with the given ID, and set its listener to the given one.
 DialogWindow getDialog(int id, Listener listener, DialogWindow dialog)
          Get the dialog with the given ID, and set its listener to the given one.
 DialogWindow getDialog(int id, Listener listener, Factory factory)
          Get the dialog with the given ID, and set its listener to the given one.
 int[] getIds(int wantedType)
          Return a list of the IDs of the specified type in this ResourceDatabase, or null if there are no such resources.
 int getInt(int id)
          Get the integer resource value with the given ID.
 InputStream getJavaResourceAsStream(int index)
          Returns an input stream corresponding to the java resource with the specified index.
 int getJavaResourceCount()
          Returns the number of java resources in this database.
 String getJavaResourceName(int index)
          Returns the name of the java resource with the specified index.
 String getLocaleString(String inLocale, int id)
          Get a localized string.
 Menu getMenu(int id)
          Get the menu with the specified resource id.
 Menu getMenu(int id, Listener listener)
          Get the menu with the specified resource id.
protected  Menu getMenu(int id, Listener listener, Window textEditBaseWindow)
          Get the menu with the specified resource id.
 Resource getResource(int type, int id)
          Obtain a specific resource, locating it by type and id.
 InputStream getResourceStream(int type, int id)
          Obtain a specific resource, locating it by type and id.
 Tone[] getRingToneArray(int id)
          Gets the ring tone array with the specified id.
 ScreenWindow getScreen(int id)
          Get the screen with the given ID.
 ScreenWindow getScreen(int id, Listener listener)
          Get the screen with the given ID, and set its listener to the given one.
 ScreenWindow getScreen(int id, Listener listener, Factory factory)
          Get the screen with the given ID, and set its listener to the given one.
 ScreenWindow getScreen(int id, Listener listener, ScreenWindow window)
          Get the screen with the given ID, and set its listener to the given one.
 SplashScreen getSplashScreen(int id)
          Get the splash screen with the given ID.
 SplashScreen getSplashScreen(int id, Factory factory)
          Get the splash screen with the given ID.
 SplashScreen getSplashScreen(int id, SplashScreen splashScreen)
          Get the splash screen with the given ID.
 String getString(int id)
          Obtain a specific string resource or the null string if such a string resource does not exist.
 String[] getStringArray(int id)
          Get the string array with the specified resource id.
 boolean getStringArray(int id, String[] strings, int offset)
          Get the string array with the specified resource id.
 int getStringArraySize(int id)
          Get number of strings a string array.
static AlertWindow getSysAlert(int id)
          Deprecated. For internal use only.
static AlertWindow getSysAlert(int id, Listener listener)
          Deprecated. For internal use only.
static Bitmap getSysBitmap(int id)
          Deprecated. For internal use only.
static Bitmap[] getSysBitmapArray(int id)
          Deprecated. For internal use only.
static int getSysBitmapArrayCount(int id)
          Deprecated. For internal use only.
static Bitmap getSysBitmapFromArray(int id, int index)
          Deprecated. For internal use only.
static DialogWindow getSysDialog(int id)
          Deprecated. For internal use only.
static DialogWindow getSysDialog(int id, Listener listener)
          Deprecated. For internal use only.
static DialogWindow getSysDialog(int id, Listener listener, DialogWindow dialog)
          Deprecated. For internal use only.
static int[] getSysIds(int wantedType)
          Deprecated. For internal use only.
static int getSysInt(int id)
          Deprecated. For internal use only.
static String getSysLocaleString(String inLocale, int id)
          Deprecated. For internal use only.
static Resource getSysResource(int type, int id)
          Deprecated. For internal use only.
static Tone[] getSysRingToneArray(int id)
          Deprecated. For internal use only.
static String getSysString(int id)
          Deprecated. For internal use only.
static String[] getSysStringArray(int id)
          Deprecated. For internal use only.
static ResourceDatabase getSystemResources()
          Deprecated. For internal use only.
static TextInputAlertWindow getSysTextInputAlert(int id, Listener listener)
          Deprecated. For internal use only.
 TextInputAlertWindow getTextInputAlert(int id, Listener listener)
          Get the text input alert with the given ID, and set its listener to the given one.
 TextInputAlertWindow getTextInputAlert(int id, Listener listener, Factory factory)
          Get the text input alert with the given ID, and set its listener to the given one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RSRC_STRING

public static final int RSRC_STRING
String resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

See Also:
Constant Field Values

RSRC_BITMAP

public static final int RSRC_BITMAP
Bitmap resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

See Also:
Constant Field Values

RSRC_SOUND

public static final int RSRC_SOUND
Sound resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

See Also:
Constant Field Values

RSRC_SEQUENCE

public static final int RSRC_SEQUENCE
Sequence resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

See Also:
Constant Field Values

RSRC_INT

public static final int RSRC_INT
Integer resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

Since:
2.0
See Also:
Constant Field Values

RSRC_MENU

public static final int RSRC_MENU
Menu resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

See Also:
Constant Field Values

RSRC_STRINGTABLE

public static final int RSRC_STRINGTABLE
String table resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

See Also:
Constant Field Values

RSRC_ALERT

public static final int RSRC_ALERT
Alert resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

See Also:
Constant Field Values

RSRC_DIALOG

public static final int RSRC_DIALOG
Dialog resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

See Also:
Constant Field Values

RSRC_SCREEN

public static final int RSRC_SCREEN
Screen resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

See Also:
Constant Field Values

RSRC_STRING_ARRAY

public static final int RSRC_STRING_ARRAY
String array resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

See Also:
Constant Field Values

RSRC_BITMAP_ARRAY

public static final int RSRC_BITMAP_ARRAY
Bitmap array resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

See Also:
Constant Field Values

RSRC_RINGTONE_ARRAY

public static final int RSRC_RINGTONE_ARRAY
Ringtone array resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

See Also:
Constant Field Values

RSRC_TEXT_INPUT_ALERT

public static final int RSRC_TEXT_INPUT_ALERT
Text input alert resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

See Also:
Constant Field Values

RSRC_SPLASH_SCREEN

public static final int RSRC_SPLASH_SCREEN
Splash screen resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

Since:
1.1e
See Also:
Constant Field Values

RSRC_JAVA

public static final int RSRC_JAVA
Java resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

Since:
2.0
See Also:
Constant Field Values

RSRC_CONTAINER

public static final int RSRC_CONTAINER
Container resource type. This constant can be used with several ResourceDatabase calls, including getResource(int, int) and getResourceStream(int, int).

Since:
2.3
See Also:
Constant Field Values
Method Detail

getSysInt

public static int getSysInt(int id)
Deprecated. For internal use only.


getInt

public int getInt(int id)
Get the integer resource value with the given ID. Throws an exception if no such resource exists.

Parameters:
id - the resource ID of the integer resource
Returns:
the integer resource value
Since:
2.0

getString

public String getString(int id)
Obtain a specific string resource or the null string if such a string resource does not exist.


getSysString

public static String getSysString(int id)
Deprecated. For internal use only.


getStringArraySize

public int getStringArraySize(int id)
Get number of strings a string array.

Parameters:
id - the resource id of the string array
Since:
3.0

getStringArray

public String[] getStringArray(int id)
Get the string array with the specified resource id.


getStringArray

public boolean getStringArray(int id,
                              String[] strings,
                              int offset)
Get the string array with the specified resource id. Returns true if the array was obtained, false if the resource could not be found or decoded.

Parameters:
id - the resource id of the string array
strings - the array to put the strings into
offset - an index into strings to start putting the strings into
Since:
3.0

getSysStringArray

public static String[] getSysStringArray(int id)
Deprecated. For internal use only.


getJavaResourceCount

public int getJavaResourceCount()
Returns the number of java resources in this database.

Java resources come from the javaResource tag in .rsrc files.


getJavaResourceName

public String getJavaResourceName(int index)
Returns the name of the java resource with the specified index.

Java resources come from the javaResource tag in .rsrc files.


getJavaResourceAsStream

public InputStream getJavaResourceAsStream(int index)
Returns an input stream corresponding to the java resource with the specified index. Can be used in conjunction with getJavaResourceCount() to get all the java resources.

Java resources come from the javaResource tag in .rsrc files.


findAbsoluteJavaResource

public InputStream findAbsoluteJavaResource(String name)
Returns an input stream for the java resource with the specified name.

Java resources come from the javaResource tag in .rsrc files.


getBitmap

public Bitmap getBitmap(int id)
Obtain a specific bitmap resource or null if such a bitmap resource does not exist.


getAnimatedBitmap

public AnimatedBitmap getAnimatedBitmap(int id,
                                        int decodeFlags)
Obtain a specific animated bitmap resource or null if such a bitmap resource does not exist.

Parameters:
decodeFlags - flags to pass to AnimatedBitmap.create(byte[], int)

getSysBitmap

public static Bitmap getSysBitmap(int id)
Deprecated. For internal use only.


getBitmapArray

public Bitmap[] getBitmapArray(int id)
Get the bitmap array with the specified resource id.


getBitmapArrayCount

public int getBitmapArrayCount(int id)
Return the number of bitmaps in an array. Can be used in conjunction with getBitmapFromArray(int, int).

Parameters:
id - the resource ID of the bitmap array

getBitmapFromArray

public Bitmap getBitmapFromArray(int id,
                                 int index)
Get a bitmap from an array. If you want all bitmaps from an array, then it is better to call getBitmapArray(int). If you only want one or two bitmaps, then it is better to call getBitmapFromArray, which only decodes the image you request.

Parameters:
id - the resource ID of the bitmap array
index - index of the bitmap (starting at 0)

getAnimatedBitmapFromArray

public AnimatedBitmap getAnimatedBitmapFromArray(int id,
                                                 int index,
                                                 int decodeFlags)
Get an animated bitmap from an array. This only decodes the image you request and skips others in the array.

Parameters:
id - the resource ID of the bitmap array
index - index of the animated bitmap (starting at 0)
decodeFlags - flags to pass to AnimatedBitmap.create(byte[], int) when creating the bitmap

getSysBitmapArray

public static Bitmap[] getSysBitmapArray(int id)
Deprecated. For internal use only.


getSysBitmapFromArray

public static Bitmap getSysBitmapFromArray(int id,
                                           int index)
Deprecated. For internal use only.


getSysBitmapArrayCount

public static int getSysBitmapArrayCount(int id)
Deprecated. For internal use only.


getMenu

public Menu getMenu(int id)
Get the menu with the specified resource id. Since no listener is specified, menu events will be sent to the menu itself. No text edit base window is specified in this version of getMenu.

Parameters:
id - the id of the menu resource

getMenu

public Menu getMenu(int id,
                    Listener listener)
Get the menu with the specified resource id. Menu events will be sent to the specified listener. No text edit base window is specified in this version of getMenu.

Parameters:
id - the id of the menu resource
listener - the listener for the menu events

getMenu

protected Menu getMenu(int id,
                       Listener listener,
                       Window textEditBaseWindow)
Get the menu with the specified resource id. Menu events will be sent to the specified listener. If the menu has a text edit menu, then the specified textEditBaseWindow will be passed into a call to BaseMenu.addTextEditItems(danger.ui.Window). NOTE: you still need to call BaseMenu.updateTextEditItems(danger.ui.Window) yourself.

Parameters:
id - the id of the menu resource
listener - the listener for the menu events
textEditBaseWindow - the text edit base window

addToMenuFromResource

public void addToMenuFromResource(BaseMenu menu,
                                  int id,
                                  Listener listener,
                                  Window textEditBaseWindow)
Appends a menu resource to an existing menu. It is recommended that you call BaseMenu.addFromResource(danger.app.ResourceDatabase, int) instead.

Parameters:
menu - the menu to add to
id - the id of the menu to add
listener - the listener for the menu events
textEditBaseWindow - the text edit base window

addMenuItemFromResource

public void addMenuItemFromResource(BaseMenu menu,
                                    int id,
                                    int menuItemID,
                                    int eventData,
                                    Object eventArg,
                                    Listener listener)
Appends a menu item to an existing menu. It is recommended that you call BaseMenu.addItemFromResource(danger.app.ResourceDatabase, int, int, danger.app.Listener) instead.

Parameters:
menu - the menu to add to
id - the id of the menu from which to add
menuItemID - the id of the menu item to add
eventData - the event data for the menu item
eventArg - the event arg for the menu item
listener - the listener for the menu events

getAlert

public AlertWindow getAlert(int id)
Get the alert with the given ID. The alert's listener will be set to itself.

Parameters:
id - the resource ID of the alert
Returns:
null-ok; a new instance based on the indicated resource ID or null if there was no such resource

getAlert

public AlertWindow getAlert(int id,
                            Listener listener)
Get the alert with the given ID, and set its listener to the given one.

Parameters:
id - the resource ID of the alert
listener - null-ok; the listener for the alert or null if the alert should be its own listener
Returns:
null-ok; a new instance based on the indicated resource ID or null if there was no such resource

getAlert

public AlertWindow getAlert(int id,
                            Listener listener,
                            Factory factory)
Get the alert with the given ID, and set its listener to the given one. Uses the specified Factory object, rather than the default one. This allows you to use a non-public AlertWindow class.

Parameters:
id - the resource ID of the alert
listener - null-ok; the listener for the alert or
factory - a Factory instance null if the alert should be its own listener
Returns:
null-ok; a new instance based on the indicated resource ID or null if there was no such resource

getSysAlert

public static AlertWindow getSysAlert(int id)
Deprecated. For internal use only.


getSysAlert

public static AlertWindow getSysAlert(int id,
                                      Listener listener)
Deprecated. For internal use only.


getTextInputAlert

public TextInputAlertWindow getTextInputAlert(int id,
                                              Listener listener)
Get the text input alert with the given ID, and set its listener to the given one.

Parameters:
id - the resource ID of the text input alert
listener - null-ok; the listener for the text input alert or null if the text input alert should be its own listener
Returns:
null-ok; a new instance based on the indicated resource ID or null if there was no such resource

getTextInputAlert

public TextInputAlertWindow getTextInputAlert(int id,
                                              Listener listener,
                                              Factory factory)
Get the text input alert with the given ID, and set its listener to the given one. Uses the specified Factory object, rather than the default one. This allows you to use a non-public TextInputAlertWindow class.

Parameters:
id - the resource ID of the text input alert
listener - null-ok; the listener for the text input alert or
factory - a Factory instance null if the text input alert should be its own listener
Returns:
null-ok; a new instance based on the indicated resource ID or null if there was no such resource

getSysTextInputAlert

public static TextInputAlertWindow getSysTextInputAlert(int id,
                                                        Listener listener)
Deprecated. For internal use only.


getScreen

public ScreenWindow getScreen(int id)
Get the screen with the given ID. The screen's listener will be set to itself.

Parameters:
id - the resource ID of the screen
Returns:
null-ok; a new instance based on the indicated resource ID or null if there was no such resource

getScreen

public ScreenWindow getScreen(int id,
                              Listener listener)
Get the screen with the given ID, and set its listener to the given one.

Parameters:
id - the resource ID of the screen
listener - null-ok; the listener for the screen or null if the screen should be its own listener
Returns:
null-ok; a new instance based on the indicated resource ID or null if there was no such resource

getScreen

public ScreenWindow getScreen(int id,
                              Listener listener,
                              ScreenWindow window)
Get the screen with the given ID, and set its listener to the given one. Uses the specified ScreenWindow object, rather than creating a new one.

Parameters:
id - the resource ID of the screen
listener - null-ok; the listener for the screen or null if the screen should be its own listener
Returns:
null-ok; a new instance based on the indicated resource ID or null if there was no such resource

getScreen

public ScreenWindow getScreen(int id,
                              Listener listener,
                              Factory factory)
Get the screen with the given ID, and set its listener to the given one. Uses the specified Factory object, rather than the default one. This allows you to use non-public views or windows in resources.

Parameters:
id - the resource ID of the screen
listener - null-ok; the listener for the screen or
factory - a Factory instance null if the screen should be its own listener
Returns:
null-ok; a new instance based on the indicated resource ID or null if there was no such resource

getSplashScreen

public SplashScreen getSplashScreen(int id)
Get the splash screen with the given ID.

Parameters:
id - the resource ID of the screen
Returns:
null-ok; a new instance based on the indicated resource ID or null if there was no such resource

getSplashScreen

public SplashScreen getSplashScreen(int id,
                                    Factory factory)
Get the splash screen with the given ID.

Parameters:
id - the resource ID of the screen
factory - a Factory instance
Returns:
null-ok; a new instance based on the indicated resource ID or null if there was no such resource
Since:
3.0

getSplashScreen

public SplashScreen getSplashScreen(int id,
                                    SplashScreen splashScreen)
Get the splash screen with the given ID.

Parameters:
splashScreen - use this object, rather than creating a new SplashScreen object
id - the resource ID of the screen
Returns:
null-ok; a new instance based on the indicated resource ID or null if there was no such resource
Since:
3.0

addToContainerFromDialogResource

public void addToContainerFromDialogResource(Container container,
                                             int id,
                                             Listener listener)
Adds widgets from a dialog resource to an existing container. It is recommended that you call Container.addFromDialogResource(int) instead. Returns the container that was added.

Parameters:
container - the container to add to
id - the id of the dialog resource to add from
listener - null-ok; the listener for the container or null if the container should be its own listener

addToContainerFromContainerResource

public Container addToContainerFromContainerResource(Container container,
                                                     int id,
                                                     Listener listener)
Adds widgets from a container resource to an existing container. It is recommended that you call Container.addFromContainerResource(int) instead. Returns the container that was added.

Parameters:
container - the container to add to
id - the id of the container resource to add from
listener - null-ok; the listener for the container or null if the container should be its own listener

addToContainerFromContainerResource

public Container addToContainerFromContainerResource(Container container,
                                                     int id,
                                                     Listener listener,
                                                     Factory factory)
Adds widgets from a container resource to an existing container. It is recommended that you call Container.addFromContainerResource(int) instead. Uses the specified Factory object, rather than the default one. Returns the container that was added.

Parameters:
container - the container to add to
id - the id of the container resource to add from
listener - null-ok; the listener for the container or null if the container should be its own listener
factory - a Factory instance
Since:
3.0

getSysDialog

public static DialogWindow getSysDialog(int id)
Deprecated. For internal use only.


getSysDialog

public static DialogWindow getSysDialog(int id,
                                        Listener listener,
                                        DialogWindow dialog)
Deprecated. For internal use only.


getSysDialog

public static DialogWindow getSysDialog(int id,
                                        Listener listener)
Deprecated. For internal use only.


getDialog

public DialogWindow getDialog(int id)
Get the dialog with the given ID. The dialog's listener will be set to itself.

Parameters:
id - the resource ID of the dialog
Returns:
null-ok; a new instance based on the indicated resource ID or null if there was no such resource

getDialog

public DialogWindow getDialog(int id,
                              Listener listener)
Get the dialog with the given ID, and set its listener to the given one.

Parameters:
id - the resource ID of the dialog
listener - null-ok; the listener for the dialog or null if the dialog should be its own listener
Returns:
null-ok; a new instance based on the indicated resource ID or null if there was no such resource

getDialog

public DialogWindow getDialog(int id,
                              Listener listener,
                              DialogWindow dialog)
Get the dialog with the given ID, and set its listener to the given one. Uses the specified DialogWindow object, rather than creating a new one.

Parameters:
id - the resource ID of the dialog
listener - null-ok; the listener for the dialog or null if the dialog should be its own listener
Returns:
null-ok; a new instance based on the indicated resource ID or null if there was no such resource

getDialog

public DialogWindow getDialog(int id,
                              Listener listener,
                              Factory factory)
Get the dialog with the given ID, and set its listener to the given one. Uses the specified Factory object, rather than the default one. This allows you to use non-public views or windows in resources.

Parameters:
id - the resource ID of the dialog
listener - null-ok; the listener for the dialog or
factory - a Factory instance null if the dialog should be its own listener
Returns:
null-ok; a new instance based on the indicated resource ID or null if there was no such resource

getSysRingToneArray

public static Tone[] getSysRingToneArray(int id)
Deprecated. For internal use only.


getRingToneArray

public Tone[] getRingToneArray(int id)
Gets the ring tone array with the specified id. Generally, you will instead want to directly call ToneGallery.register(danger.audio.ToneRecordStore). You can pass in a ResourceDatabase and a resource id to one version of that method.


getResource

public Resource getResource(int type,
                            int id)
Obtain a specific resource, locating it by type and id.


getSysResource

public static Resource getSysResource(int type,
                                      int id)
Deprecated. For internal use only.


getResourceStream

public InputStream getResourceStream(int type,
                                     int id)
Obtain a specific resource, locating it by type and id. Return the resource as a stream.


getIds

public int[] getIds(int wantedType)
Return a list of the IDs of the specified type in this ResourceDatabase, or null if there are no such resources. Versions 1.1 through 2.1 had the bug that in locales that inherit some resources from other locales (basically all locales other than en_US), only the resources not inherited from another locale would be returned. Beginning in the 2.3 release, this method merges in the IDs of resources inherited from ancestral RDBs (but still stops short of walking all the way back to the system resources).


getSysIds

public static int[] getSysIds(int wantedType)
Deprecated. For internal use only.


getAvailableLocales

public static final String[] getAvailableLocales()
Returns an array of the locales available on this device.

Each locale is represented by a 5-character string, such as en_US for US English.


getLocaleString

public final String getLocaleString(String inLocale,
                                    int id)
Get a localized string. Returns the string with the specified resource id for the specified locale.

Parameters:
inLocale - the locale to find the string in
id - the string resource id

getSysLocaleString

public static final String getSysLocaleString(String inLocale,
                                              int id)
Deprecated. For internal use only.


getSystemResources

public static ResourceDatabase getSystemResources()
Deprecated. For internal use only.