Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
heighgun
Posts: 17
Registered: ‎08-29-2010
My Device: Not Specified

how to refresh screen display of a running app after language changed?

I found when use apps like Contacs,BBM can change automatically, steps as below:

 

1. open Contacts app.

2. click "New Contact" button to show "New Contact" screen.

3. switch to Home and change language in Options->Typing and input->language->Display language.

4. switch backt to Contacts app.

 

 

after these steps text on the"New Contact" screen not changed, then I use "back" key to return to first screen of Contacts app and text on this screen changed.

 

So, I want to know how to do like that in my app?  use invalidate() and updateDisplay methods of Screens in Display Stack seems has no effect.

Please use plain text.
New Developer
heighgun
Posts: 17
Registered: ‎08-29-2010
My Device: Not Specified

Re: how to refresh screen display of a running app after language changed?

NO one can answer this question? Let me state more clearly:

 

I adopt  multi-language solution as the way in Localizing_V2.pdf.

 

protected void makeMenu(Menu menu, int instance) {
menu.add(_english);
menu.add(_french);
menu.add(_spanish);
menu.add(_close);
}


private MenuItem _close = new MenuItem(_res.getString(CLOSE), 110, 10) {
public void run() {
onClose();
}
};


private MenuItem _english = new MenuItem(_res.getString(ENGLISH), 110, 10)
{
public void run() {
Locale.setDefault (Locale.get(Locale.LOCALE_en, null));
refresh();
}
};


private MenuItem _french = new MenuItem(_res.getString(FRENCH), 110, 10) {
public void run() {
Locale.setDefault (Locale.get(Locale.LOCALE_fr, null));
refresh();
}
};


private MenuItem _spanish = new MenuItem(_res.getString(SPANISH), 110, 10)
{
public void run() {
Locale.setDefault (Locale.get(Locale.LOCALE_es, null));
refresh();
}
};

 

private void refresh() {
title.setText(_res.getString(FIELD_TITLE));
deleteAll();
rtf = new RichTextField(_res.getString(MESSAGE));
add(rtf);
_english.setText(_res.getString(ENGLISH));
_french.setText(_res.getString(FRENCH));
_spanish.setText(_res.getString(SPANISH));
_close.setText(_res.getString(CLOSE));
}

 

and it reads "Remember, you do not need to refresh your application in your application; this is done only
because the example changes the Locale language while it is running." Is this mean you have to delete and rebuild all UI controls on screens in display stack? Is the apps built-in of Simulator use this way?

Please use plain text.
New Developer
heighgun
Posts: 17
Registered: ‎08-29-2010
My Device: Not Specified

Re: how to refresh screen display of a running app after language changed?

tried more built-in apps and found not all these apps can refresh all text  showing on an screen below.

Please use plain text.
Developer
peter_strange
Posts: 19,603
Registered: ‎07-14-2008
My Device: Not Specified

Re: how to refresh screen display of a running app after language changed?

 Say in your code you do something like the following in your screens constructor:

 

String displayString = Resouce.getString(xxxx);

LabelField lab = new LabelField(displayString);

this.add(lab);

 

Now it is clear from this code that the resource conversion is done when the Screen is built.  So you will need to rebuild;the screen to update this, should the locale changeI suspect the same is true of most apps

 

Please use plain text.