|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdanger.app.ResourceDatabase
public abstract class ResourceDatabase
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 |
|---|
public static final int RSRC_STRING
getResource(int, int)
and getResourceStream(int, int).
public static final int RSRC_BITMAP
getResource(int, int)
and getResourceStream(int, int).
public static final int RSRC_SOUND
getResource(int, int)
and getResourceStream(int, int).
public static final int RSRC_SEQUENCE
getResource(int, int)
and getResourceStream(int, int).
public static final int RSRC_INT
getResource(int, int)
and getResourceStream(int, int).
public static final int RSRC_MENU
getResource(int, int)
and getResourceStream(int, int).
public static final int RSRC_STRINGTABLE
getResource(int, int)
and getResourceStream(int, int).
public static final int RSRC_ALERT
getResource(int, int)
and getResourceStream(int, int).
public static final int RSRC_DIALOG
getResource(int, int)
and getResourceStream(int, int).
public static final int RSRC_SCREEN
getResource(int, int)
and getResourceStream(int, int).
public static final int RSRC_STRING_ARRAY
getResource(int, int)
and getResourceStream(int, int).
public static final int RSRC_BITMAP_ARRAY
getResource(int, int)
and getResourceStream(int, int).
public static final int RSRC_RINGTONE_ARRAY
getResource(int, int)
and getResourceStream(int, int).
public static final int RSRC_TEXT_INPUT_ALERT
getResource(int, int)
and getResourceStream(int, int).
public static final int RSRC_SPLASH_SCREEN
getResource(int, int)
and getResourceStream(int, int).
public static final int RSRC_JAVA
getResource(int, int)
and getResourceStream(int, int).
public static final int RSRC_CONTAINER
getResource(int, int)
and getResourceStream(int, int).
| Method Detail |
|---|
public static int getSysInt(int id)
public int getInt(int id)
id - the resource ID of the integer resource
public String getString(int id)
public static String getSysString(int id)
public int getStringArraySize(int id)
id - the resource id of the string arraypublic String[] getStringArray(int id)
public boolean getStringArray(int id,
String[] strings,
int offset)
id - the resource id of the string arraystrings - the array to put the strings intooffset - an index into strings to start putting
the strings intopublic static String[] getSysStringArray(int id)
public int getJavaResourceCount()
Java resources come from the javaResource tag in .rsrc files.
public String getJavaResourceName(int index)
Java resources come from the javaResource tag in .rsrc files.
public InputStream getJavaResourceAsStream(int index)
getJavaResourceCount() to get all the java resources.
Java resources come from the javaResource tag in .rsrc files.
public InputStream findAbsoluteJavaResource(String name)
Java resources come from the javaResource tag in .rsrc files.
public Bitmap getBitmap(int id)
public AnimatedBitmap getAnimatedBitmap(int id,
int decodeFlags)
decodeFlags - flags to pass to AnimatedBitmap.create(byte[], int)public static Bitmap getSysBitmap(int id)
public Bitmap[] getBitmapArray(int id)
public int getBitmapArrayCount(int id)
getBitmapFromArray(int, int).
id - the resource ID of the bitmap array
public Bitmap getBitmapFromArray(int id,
int index)
getBitmapArray(int). If you only want one or
two bitmaps, then it is better to call getBitmapFromArray,
which only decodes the image you request.
id - the resource ID of the bitmap arrayindex - index of the bitmap (starting at 0)
public AnimatedBitmap getAnimatedBitmapFromArray(int id,
int index,
int decodeFlags)
id - the resource ID of the bitmap arrayindex - index of the animated bitmap (starting at 0)decodeFlags - flags to pass to AnimatedBitmap.create(byte[], int)
when creating the bitmappublic static Bitmap[] getSysBitmapArray(int id)
public static Bitmap getSysBitmapFromArray(int id,
int index)
public static int getSysBitmapArrayCount(int id)
public Menu getMenu(int id)
id - the id of the menu resource
public Menu getMenu(int id,
Listener listener)
id - the id of the menu resourcelistener - the listener for the menu events
protected Menu getMenu(int id,
Listener listener,
Window textEditBaseWindow)
BaseMenu.addTextEditItems(danger.ui.Window). NOTE: you still
need to call BaseMenu.updateTextEditItems(danger.ui.Window)
yourself.
id - the id of the menu resourcelistener - the listener for the menu eventstextEditBaseWindow - the text edit base window
public void addToMenuFromResource(BaseMenu menu,
int id,
Listener listener,
Window textEditBaseWindow)
BaseMenu.addFromResource(danger.app.ResourceDatabase, int)
instead.
menu - the menu to add toid - the id of the menu to addlistener - the listener for the menu eventstextEditBaseWindow - the text edit base window
public void addMenuItemFromResource(BaseMenu menu,
int id,
int menuItemID,
int eventData,
Object eventArg,
Listener listener)
BaseMenu.addItemFromResource(danger.app.ResourceDatabase, int, int, danger.app.Listener)
instead.
menu - the menu to add toid - the id of the menu from which to addmenuItemID - the id of the menu item to addeventData - the event data for the menu itemeventArg - the event arg for the menu itemlistener - the listener for the menu eventspublic AlertWindow getAlert(int id)
id - the resource ID of the alert
null if there was no such resource
public AlertWindow getAlert(int id,
Listener listener)
id - the resource ID of the alertlistener - null-ok; the listener for the alert or
null if the alert should be its own listener
null if there was no such resource
public AlertWindow getAlert(int id,
Listener listener,
Factory factory)
id - the resource ID of the alertlistener - null-ok; the listener for the alert orfactory - a Factory instance
null if the alert should be its own listener
null if there was no such resourcepublic static AlertWindow getSysAlert(int id)
public static AlertWindow getSysAlert(int id,
Listener listener)
public TextInputAlertWindow getTextInputAlert(int id,
Listener listener)
id - the resource ID of the text input alertlistener - null-ok; the listener for the text input alert or
null if the text input alert should be its own listener
null if there was no such resource
public TextInputAlertWindow getTextInputAlert(int id,
Listener listener,
Factory factory)
id - the resource ID of the text input alertlistener - null-ok; the listener for the text input alert orfactory - a Factory instance
null if the text input alert should be its own listener
null if there was no such resource
public static TextInputAlertWindow getSysTextInputAlert(int id,
Listener listener)
public ScreenWindow getScreen(int id)
id - the resource ID of the screen
null if there was no such resource
public ScreenWindow getScreen(int id,
Listener listener)
id - the resource ID of the screenlistener - null-ok; the listener for the screen or
null if the screen should be its own listener
null if there was no such resource
public ScreenWindow getScreen(int id,
Listener listener,
ScreenWindow window)
id - the resource ID of the screenlistener - null-ok; the listener for the screen or
null if the screen should be its own listener
null if there was no such resource
public ScreenWindow getScreen(int id,
Listener listener,
Factory factory)
id - the resource ID of the screenlistener - null-ok; the listener for the screen orfactory - a Factory instance
null if the screen should be its own listener
null if there was no such resourcepublic SplashScreen getSplashScreen(int id)
id - the resource ID of the screen
null if there was no such resource
public SplashScreen getSplashScreen(int id,
Factory factory)
id - the resource ID of the screenfactory - a Factory instance
null if there was no such resource
public SplashScreen getSplashScreen(int id,
SplashScreen splashScreen)
splashScreen - use this object, rather than creating a new
SplashScreen objectid - the resource ID of the screen
null if there was no such resource
public void addToContainerFromDialogResource(Container container,
int id,
Listener listener)
Container.addFromDialogResource(int)
instead.
Returns the container that was added.
container - the container to add toid - the id of the dialog resource to add fromlistener - null-ok; the listener for the container or
null if the container should be its own listener
public Container addToContainerFromContainerResource(Container container,
int id,
Listener listener)
Container.addFromContainerResource(int)
instead.
Returns the container that was added.
container - the container to add toid - the id of the container resource to add fromlistener - null-ok; the listener for the container or
null if the container should be its own listener
public Container addToContainerFromContainerResource(Container container,
int id,
Listener listener,
Factory factory)
Container.addFromContainerResource(int)
instead.
Uses the specified Factory object, rather than the default one.
Returns the container that was added.
container - the container to add toid - the id of the container resource to add fromlistener - null-ok; the listener for the container or
null if the container should be its own listenerfactory - a Factory instancepublic static DialogWindow getSysDialog(int id)
public static DialogWindow getSysDialog(int id,
Listener listener,
DialogWindow dialog)
public static DialogWindow getSysDialog(int id,
Listener listener)
public DialogWindow getDialog(int id)
id - the resource ID of the dialog
null if there was no such resource
public DialogWindow getDialog(int id,
Listener listener)
id - the resource ID of the dialoglistener - null-ok; the listener for the dialog or
null if the dialog should be its own listener
null if there was no such resource
public DialogWindow getDialog(int id,
Listener listener,
DialogWindow dialog)
id - the resource ID of the dialoglistener - null-ok; the listener for the dialog or
null if the dialog should be its own listener
null if there was no such resource
public DialogWindow getDialog(int id,
Listener listener,
Factory factory)
id - the resource ID of the dialoglistener - null-ok; the listener for the dialog orfactory - a Factory instance
null if the dialog should be its own listener
null if there was no such resourcepublic static Tone[] getSysRingToneArray(int id)
public Tone[] getRingToneArray(int id)
ToneGallery.register(danger.audio.ToneRecordStore). You can pass in a ResourceDatabase
and a resource id to one version of that method.
public Resource getResource(int type,
int id)
public static Resource getSysResource(int type,
int id)
public InputStream getResourceStream(int type,
int id)
public int[] getIds(int wantedType)
public static int[] getSysIds(int wantedType)
public static final String[] getAvailableLocales()
Each locale is represented by a 5-character string, such as en_US for US English.
public final String getLocaleString(String inLocale,
int id)
inLocale - the locale to find the string inid - the string resource id
public static final String getSysLocaleString(String inLocale,
int id)
public static ResourceDatabase getSystemResources()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||