Get a resource by using a string key

Hello

How to make an array of strings using a string key of resource...

for example, I have 4 tables of string defined in resources.

D1, d2, d3, d4

How can I get these resources.

private static nameResources ResourceBundle is ResourceBundle.getBundle (BUNDLE_ID, BUNDLE_NAME);.

It seems you want to have the advantage to use localization, but also to make code that selects the key dynamic localization.

You will need to present this dynamic change.  Here is an example (not your example exactly, but something I hope you can extend your needs).

Suppose you have the choice between 3 messages, and you choose us the one determined by the variable messageIndex you set which can be 0, 1, or 2.  Messages are resources, and have the ID

MESSAGE_ZERO

MESSAGE_ONE

MESSAGE_TWO

In your program, you can do the following:

private static nameResources ResourceBundle is ResourceBundle.getBundle (BUNDLE_ID, BUNDLE_NAME);.

private messages of the static string = new {String]

nameResources.getString (MESSAGE_ZERO),

nameResources.getString (MESSAGE_ONE),

nameResources.getString (MESSAGE_TWO)

}

....

String thisMessage = messages [messageIndex];

Edit:

If you wanted to extend this so that you can use a string as the 'index', then the easiest option would be to replace message board in the above example with a hash table and fill the table using hash

-the channels that you want to search on as keys, and

-the extracted values of all resources data.

Hope it makes sense.

Tags: BlackBerry Developers

Similar Questions

  • Activate search resource group using the string key

    Hi all

    RIM has provided APIs (Resource Bundle) to support the localization of the applications. We are able to use it

    ResourceBundle.getBundle(BUNDLE_ID, BUNDLE_NAME).getString(key);
    

    He expects int key and generated dynamically by Blackberry. There are 2 cases.

    1. Local labels, we are aware and we can provide keys for those who, for the latter is no problem.
    2. From backend error codes. This is not a definitive list. This is the string value. But we cannot find the resource group by using this key of type string. We have to check what the error code and create the key to this and allows to retrieve the label.
    if(errorCode.equals("SOME_ERROR_CODE"){
       Dialog.alert(LanguageResource.getString(SOME_ERROR_CODE));
    } else if (errorCode.equals("ANOTHER_ERROR_CODE"){
       Dialog.alert(LanguageResource.getString(ANOTHER_ERROR_CODE));}
    

    To avoid this check, we thought that if this was possible.

    String msg =  LanguageResource.getString("SOME_ERROR_CODE"));
    if (msg == null) // Label not found
       Dialog.alert(LanguageResource.getString("GENERAL_ERROR");
    else
      Dialog.alert(msg);
    

    Now, API provides no support for this, is the solution to create the own property file and load them but I think that the Blackberry does support playback of the file as Java Standard properties or may be something else. The same reflection API is not supported in Blackberry up to now, there may be support in the future. This could allow to dynamically use the variable as the key name.

    Someone did it faced simular situation and made a work around? All entries would help.

    Kind regards

    Sandeep

    Edited: updated information on option of the reflection API.

    It will never take in charge of reflection as the baseline for BB Os is J2ME and therefor java 1.3/1.4

    you will have to translate the error to the resource key string yourself.

  • where can I use my sync key?

    If Firefox put updated its sync system is no longer need a synchronization key I guess. I still all my data locked up and I got my key to sync but since the update, I can't understand how to unlock using my key synchronization. My question is, where do I go to get all my data using my sync key? I need a url or some sort of link because this is no where I can find.

    You need to install a version of Firefox 28 if you want to access the data stored in a synchronization account that uses the old version of Sync.

    You can upgrade again to the current version of Firefox 30 once you have restored your synchronized data.

  • If I use my network key and plug it on my slim xbox360 xbox live wil I get

    If I use my network key and taken in my xbox360 slim wil I get xbox live... I want to make a network on a USB flash drive and plugging dirrectly to my Xbox 360 slim usb port and and get live xbox can I do and is so, how do I do I already know how to do a network on a flash drive I just need info on the end of the xbox of my? Please please please help help help... and if it is not possible to s what are other sollutions I can use I already pay for im internet does not seek to get the hot spot and pay for internet 2 times I just want to be able to takr my anywhare xbox and use my internet without having to worry to connect to xbox live and also are thare any kind of hubs of wifi router, I can use HELP HELP HELP...

    http://forums.Xbox.com/ is where you should be asking.

  • Windows Mail is not refreshing since 09/02/2012. When I try to update using the F5 key, I get the error messages.

    Windows Mail is not refreshing since 09/02/2012.  When I try to update using the F5 key, I get the error messages.  The only way I can see me new emails is to sign on the web page of my Internet service provider, which I don't like.

    original title: windows mail is NOT refreshing

    It would be useful that Microsoft has put a notice to have several products access our email accounts so that us non-technical people could avoid these problems.

    Maybe it's something that Apple should warn the consumer. I have three e-mail accounts and I receive and send all the accounts on three different computers at the same time and have never had this problem. Your case is the first.

  • Can I use my product key to get a vista installation disc sent me to start ona computer broken?

    My desktop came with Vista already installed, but after a total crash, I need to start over.  I have no OS on it right now, but I have the official Windows product key.  Can I use this product key to get a physical boot disk?

    Hello

    There is no free and legal Vista download

    Here are the different ways to reinstall vista

    Microsoft provides no DVD of vista for Dell brand name computers Acer etc.

    Contact the computer manufacturer and ask them to send you to vista recovery disks to reinstall the operating system back as it was when you bought it

    they do it for a nominal cost of $

    also ask them if you have a recovery partition on your hard drive to get back to the way you bought

    you would normally press F8, F9, F10 or F11 or Alt + F10 or 0 to start to start the recovery process according to the manufacturer

    Ask them of the exact key sequence

    or borrow a vista microsoft dvd; not a HP, Acer recovery disk etc

    Make sure that you borrow the correct 32-bit or 64-bit microsoft dvd to your computer

    they contain all versions of vista

    This is the product key that determines which version of vista is installed

    http://www.theeldergeek.com/Vista/vista_clean_installation.html

    How to replace Microsoft software or hardware, order service packs and replace product manuals

    http://support.Microsoft.com/kb/326246

  • my wireless connection says "restricted access" no network connection. I used the same key code to get my other computer online

    my wireless connection says "restricted access" no network connection, I used the same key code to get my other computer I can have up to 5 computers online at the same time online.

    Ideas:

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    Hello

    This means that the computer cannot connect to the router.

    Try this process.

    Check the Device Manager for the wireless card valid entry.

    http://www.ezlan.NET/Win7/net_dm.jpg

    If there is no valid entry, remove any entry from fake and re - install the drivers for the wireless card.

    Check network connections to make sure that you have a network icon/entry wireless connection, and that the properties of the icon (right-click on the icon) are correctly configured with the TCP/IPv4 protocol in the properties of network connections.

    http://www.ezlan.NET/Win7/net_connection_tcp.jpg

    Make sure that if there is Wireless Utility a utility vendor is not running with the native Windows wireless utility.

    Make sure you firewall No. preventing / blocks wireless components to join the network.

    Stack TCP/IP work should look like.

    Right-click on the wireless network connection card, select status, details and see if she got an IP address and the rest of the settings.

    http://www.ezlan.NET/Win7/status-NIC.jpg

    Description is the data of the card making.

    The physical address is MAC of the card number.

    The xx must be a number between 0 and 255 (all xx even number).

    YY should be between 0 and 255

    ZZ should be between 0 and 255 (zz all the same number.)

    The date of the lease must be valid at the present time.

    * Note 1. IP that starts with 169.xxx.xxx.xxx isn't valid functional IP.

    * Note 2. There could be an IPv6 entries too. However, they are not functional for Internet or LAN traffic. They are necessary for Win 7 homegroup special configuration.

    ---------------------------------------------------

    Above everything is OK, you must be able to connect to the router.  A window that says connected does not mean that you are really connected. Connection to the router means that you can enter the IP of the router base in an address bar in one go, being able to connect and configure the router menus see. If it is not connected in the log to router from any computer that can connect to the router wirelessly with a wire, disable wireless security, (make sure that the wireless SSID broadcast) is on and try to connect with no. wireless security.

    --------------------------------------------------

    I really checked and configured every thing and it doesn't work.

    Software firewall application that is not configured to allow local traffic (between the computer and the router is also a possible problem.
    some 3rd party software firewall continue to block the same aspects it traffic Local, they are turned Off (disabled). If possible, configure the firewall correctly or completely uninstall to allow a clean flow of local network traffic. If the 3rd party software is uninstalled, or disables, make sure Windows native firewall is active .

    Jack-MVP Windows Networking. WWW.EZLAN.NET

  • get error in ViewRowImpl.java when you use search by key method

    Hi Experts,

    JDEV 12.1.3.0.0

    I have a VO where the primary key that is, BusinessUnitNumber is of type VARCHAR2 (10).

    I have added a transitional attribute of type String to the VO. baptized as LocationName. Always do as updateable.

    Added an accessor of the main as VO below view

    LocationNameSosVVO1. Now make a LOV for LocationName transitional attribute.

    Now when to ViewRowImpl, I call the code below

    /**

    * Returns the value of the attribute of the LocationName calculated attribute.

    * @return the LocationName

    */

    public String getLocationName() {}

    String buNum = (String) getAttributeInternal (BUSINESSUNITNUM);

    String locationName = null;

    If (buNum! = null) {}

    Object [] obj = {buNum};

    Key = new Key (obj);

    Line lines [] = getLocationNameSosVVO1 () .findByKey (key, 1);

    If (rows! = null & & rows.length > 0) {}

    locationName = (String) rows [0] .getAttribute (0);

    }

    }

    locationName return;

    Return (String) getAttributeInternal (LOCATIONNAME);

    }

    But if I run Tester AM I get the below error.


    Foreign key index 0173106468 0 (key-value table) passed to the view object _LOCAL_VIEW_USAGE_cfa_fcr_uimodel_setup_adfbc_view_FcrSosParticipantsVO_LocationNameSosVVO1 findByKey.

    Kindly help me with this.

    Thank you

    Roy.

    FindByKey replaced by method below

    public String getLocationName() {}

    String locName = null;

    getDeptVA here is the get accessor for the view accessor 'DeptVA' in EmpDeptVO

    Set of rows from the rowset = this.getLocationNameSosVVO1 ();

    Object buNum = getAttributeInternal (BUSINESSUNITNUM);

    If the size of the range-1 to get all the lines

    rowSet.setRangeSize(-1);

    by the way the value of parameter binding view accessor

    rowSet.setNamedWhereClauseParam ("bindBusinessUnitNum", buNum);

    execution of the view accessor

    rowSet.executeQuery ();

    store the first row in the row set in deptRow (there may be several lines across lines according to the criteria)

    Line deptRow = rowSet.first ();

    If the dpetRow is not null, returning the Deptno

    {if(deptRow!=null)}

    locName = (String) deptRow.getAttribute ("LocationName");

    }

    else {}

    locName = null;

    }

    Return locName;

    It worked

  • MultiTaskFlow liaison: Hi I have a main application and several sub these i added to my resources and using their taskFlows applications in my main application by creating the multitaskFlow binding. My problem is that how can get us currently rendered you

    Hi, I have a main application and many applications these i have added to my resource and using their taskFlows in my main application by creating the multitaskFlow binding. My problem is that how can currently get us renderings taskFlow Id link MultiTaskFlow running through an action created in our main application. Please explain if we can.

    Hello

    Try to remove the af: group in the facet of the toolbar or use this code in your bean.

    UIComponent panelBox is ae.getComponent () .getParent () .getParent ();.

    Kind regards

    Ruben.

  • I don't get my screen on volume when I use my shortcut keys, why.

    suddenly I no longer have my volume on the on-screen display on my screen when I use my shortcut keys, also my f2 key for my market / internet key stop will be operate more like on the on-screen display. Help!

    Hello

    ·         What is the brand and model of the computer?

    ·         Do you use the computer laptop or desktop?

    ·         If you are using a desktop computer, what is the brand and model of the keyboard?

    ·         Were there recent changes made on the computer before the show?

    If you are facing this problem using the Microsoft keyboard, you can consult this article and check if that helps.

    Fix shortcuts or Volume control keys not working not not on Microsoft keyboards

    http://support.Microsoft.com/kb/932875

    If this isn't the case, I would say to contact the manufacturer of your computer technical support to better support site.

  • How to programmtically get the resource group in the model project

    In the proposed model I can specify the flags of the UI for EO via EL use all resources.

    Is there, is it possible programmtically get the resource group that is configured for the model project (in project property Panel) as I don't want to hardcode the path of the file.

    Have you tried the following as mentioned in one of the threads above? :

    Assuming that the property is located in com.subbanasolutions.samples.Bundle.properties

    Imports
    Import oracle.javatools.resourcebundle.BundleFactory;

    Constants
    private static final String RESOURCE_BUNDLE_NAME =
    'com.subbanasolutions.samples.Bundle ';

    Code to access all of the resources and get a value associated with a key
    ResourceBundle resourceBundle =
    BundleFactory.getBundle (RESOURCE_BUNDLE_NAME);
    If (resourceBundle! = null)
    {
    Here, FOLLOW_UP_LABEL is the key found in the resource group
    String ActivityName = resourceBundle.getString ("FOLLOW_UP_LABEL");
    }

    Thank you
    Nini

  • How get the resource group in the application model by local current-based program?

    Hi all


    We use JDeveloper Studio Edition Version 12.1.3.0.0 and deployed on GlassFish Server Open Source Edition 3.1.2.2 (build 5) and connect to the SQLServer database.


    How get the resource group in the application model by local current-based program?

    We have two local unions; En and Ar.

    -Resource Bundle for Arabic: ModelBundle_ar.properties

    -Bundle resources for English: ModelBundle_en.properties

    We try to use the code but the room below is still in English

    ResourceBundleDef resourceDef = this.getResourceBundleDef ();

    Settings regional locale = this.getDBTransaction () .getSession () .getLocale (); How to change the locale in the session?

    Dim retVal =

    StringManager.getLocalizedStringFromResourceDef (resourceDef, key,

    local, NULL, null,

    (false);

    Also, this is the code that I use when changing the local at the bean:

    Locale newLocale = new local (local);

    FacesContext context = FacesContext.getCurrentInstance ();

    context.getViewRoot () .setLocale (newLocale);

    refreshPage();



    Settings regional locale = this.getDBTransaction () .getSession () .getLocale (); How to change the locale in the session?

    This will return a locale for db connection.

    Instead, try with: ADFContext.getCurrent () .getLocale)

    Dario

  • How to extract the values of the line full in the bean to support using the primary key

    Hello

    I have a table that has columns as plant_name, business planner email id and identification of email resident engineer. Here, Plant_name is the primary key.

    Now, I have this plant's name slipped and dropped like selectonechoice (drop) on page jsff. In this user can select any name of 1 plant drop down.

    Right now, I can go get plant in backing bean name, but I can't understand how business plan for extraction and identification of email of the engineer resident in this key primary-plant_name at the bean to support.

    Please let me know if anyone has an idea in this regard.

    JDeveloper version 11.1.1.6.0

    Thanks in advance.

    Sneha

    Sneha211 wrote:

    On the jsff page

    required = "#{bindings." Plant.hints.Mandatory}.

    shortDesc = "#{bindings." Plant.hints.ToolTip}.

    ID = "soc1" unselectedLabel = "- Select -"

    autoSubmit = 'true '.

    Binding = "#{backingBeanScope.backingbean.plantbean}" > "

    ID = "si1" / >

    In backing bean

    DCBindingContainer = lBindingContainer

    (DCBindingContainer) BindingContext.getCurrent () .getCurrentBindingsEntry ();

    DCIteratorBinding lBinding = lBindingContainer.findIteratorBinding("SupplierVO1Iterator");

    NewRow row = lBinding.getCurrentRow ();

    String aamplant1 = (String) newRow.getAttribute ("Plant");

    Hi Sneha, you've written code for it

    you have found the current line and the primary key then this line, then why you not not using this same rank to get the other attributes?

    NewRow row = lBinding.getCurrentRow ();

    String aamplant1 = (String) newRow.getAttribute ("Plant");

    String businessPalnner = (String) newRow.getAttribute ("business_planner"); Returns the value of the same line

    Engineer in String = (String) newRow.getAttribute ("engineer");


    OR if your condition is like that-

    you have a primary key field value, but you do not have the corresponding line, then you can get that line and it's attribute by using the primary key value

    See - http://adfgouravtkiet.blogspot.in/2012/10/filtering-of-data-from-vo.html

    Hope it helps

    -Ashish

  • Use of the key Windows 7

    Hey,.

    I have my laptop of 2009 with a key of windows 7 on it. I'm getting a new computer (not lag) and I was wondering if I was allowed to use the code that is under my laptop computer to my new computer I am building.

    Am I allowed to use the code to another computer or do I have to buy another key?

    This key at the bottom belongs to the original recovery image that you have with your laptop and can not be used for any other activation of Windows OS. The software is provided on the equipment.

    In other words, this key is useless.
    On this forum, you can find several discussions where people try to use this product key for activation of Windows, but it doesn t work.

  • Why all my keyboard shortcuts use the 'Alt' key instead of the ' CTRL '? I use Windows 7 and Firefox 5.0.1.

    I recently downloaded Firefox 5 and noticed that all my keyboard shortcuts by default using the 'Alt' key instead of the 'Ctrl' key (so, for example, open a new tab is Alt + T instead of Ctrl + T).

    I noticed that this applies even to copy and paste in Firefox (Alt + C and Alt + P is the only commands that work).

    No idea why this is happening? I am running Windows 7 and Firefox 5.0.1.

    I had this problem. I found that a roaming profile directory has been installed which contained a user.js file in which changed the hotkey of CTRL ALT.
    I deleted the profile folder a name randomly in c:/Users / [myuser] / AppData/Roaming/Mozilla/Firefox/Profiles and then I stuck to that of c:/Users / [myuser] / AppData/Local/Mozilla/Firefox/Profiles.

    This bad user.js file was some other parameters, including the definition of the user agent string
    "Mozilla/5.0 (X 11;" U; Linux i686; en-US; RV:1.0.0; (Salut, maman) gecko/20020604 "

    The user.js file is (or similar to) those listed here: https://www-archive.mozilla.org/unix/customizing.html

Maybe you are looking for