Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8941333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:16:33+00:00 2026-06-15T11:16:33+00:00

I use codenameone to develop my mobile application. In this application I implement some

  • 0

I use codenameone to develop my mobile application. In this application I implement some classes and codes manually for instance create all forms by hard coding not using codenameone designer for some reason.

By the way I wanted to navigate in forms like what codenameone use, so I use one variable from type of Form called it prevForm and when I want to open a form I set it to current form and then I show new form.

Ok, that is main scenario. In this application I wanna implement internationalization too, so I create my own hashtable (Farsi and English) for this application.

This is my problem:

  1. How can I set or change language and apply it to forms that I opened?

  2. Is my method for navigate between forms are good?

Here is my code:

public class BaseForm extends Form implements ActionListener {
public BaseForm(){
    this.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
}

Command exit, ok, back;
Form prevForm;

protected void initForm(){

}

protected void showForm(){

}

protected void showForm(final Form prevForm){
    //String name = this.getName();
    //if("Reminder".equals(name) || "3Transaction".equals(name))
    {
        this.prevForm = prevForm;
        Form f = this;
        back = new Command("Back");
        //ok = new Command("Ok");
        //delete = new Command("Delete");;
        Button button = new Button("Button");

        f.addCommand(back);
        //f.addCommand(ok);
        //f.addCommand(delete);
        //f.addComponent(button);

        f.addCommandListener(new ActionListener() {

            public void actionPerformed(ActionEvent ae) {
                if (ae.getCommand().equals(back)) {
                    //Do Exit command code
                    System.out.println("Back pressed");
                    prevForm.showBack();
                } else if (ae.getCommand().equals(ok)) {
                    //Do Start command code
                    System.out.println("Ok pressed");
                }
            }
        });

        button.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent ae) {
                //Do button code
                System.out.println("Action performed");
            }
        });
    }
    showForm();
}}

for open nested form I use this code:

LanguageUI lang = new LanguageUI();
lang.showForm(this);

change language [form]:

protected boolean onBtnSave() {
    if(isRbFarsiSelected()){
        UIManager.getInstance().setResourceBundle(new CommonSettings().getFarsi());
    }
    else {
        UIManager.getInstance().setResourceBundle(new CommonSettings().getEnglish());
    }

    return false;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:16:34+00:00Added an answer on June 15, 2026 at 11:16 am

    I also hard code my UI on lwuit, and i have a variable parentForm on every class so i can easily show previous form. For language change i know there is Localization in the resource editor that you can make use of. Below is how you can access it. I guess the trick is how to set the content of the L10N in the res file in code? On the other hand you can create your own helper classes that mirror the methods below.

    Resources theme = Resources.open("/theme.res");
    theme.getL10N(id, locale);
    theme.getL10NResourceNames();
    theme.isL10N(name);
    theme.listL10NLocales(id)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Because codenameone can not use external libraries (HttpConnection) then I have to use the
use pthread_create to create limited number of threads running concurrently Successfully compile and run
use strict; use Time::HiRes qw[gettimeofday tv_interval]; my $start_index = int(rand(50))+100;#this value is arbitrary for
Use scenario is pretty simple: I have a desktop only application that could be
Use Memcache php class to interact with the memcached. At the beginning all works
use this code, in the Preferences activity, to know when the reset preference has
Use a hidden field will fix my issue... i got it.. Hi All, I
Use Case: Admin should be able to create user, and it should not attempt
Use trap to capture signals like this: i=-1;while((++i<33)); do trap echo $i >> log.txt
Use case: we have some project meta-data files which we want tracked, but are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.