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 268387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:41:39+00:00 2026-05-11T23:41:39+00:00

I have a j2me midlet running on a cell phone. The code works fine,

  • 0

I have a j2me midlet running on a cell phone. The code works fine, but the issue that comes up is that the program seems to be running more than one instance of itself. I have code at the beginning of the application inside the appStart() method that runs twice when the application starts. During the lifetime of the program, the code can be seen running twice when text is written to the screen.

The code looks like this:

public MyClass()
{
    form = new Form("MyProgram");
    cmdClose = new Command("EXIT", Command.EXIT, 1);

    form.addCommand(cmdClose);
    form.setCommandListener(this);

    display = Display.getDisplay(this);
    display.setCurrent(form);
}

public void startApp()
{
    form.append("App starting\n");
    // Rest of program
}

I have no idea why the code is being called twice.

I’m coding on the i290.

  • 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-05-11T23:41:40+00:00Added an answer on May 11, 2026 at 11:41 pm

    This is definitely a JVM bug. startApp() should be called only once at startup and can’t be called again until pauseApp() is called or you call notifyPaused() yourself.

    What I suggest is the following code:

    private boolean midletStarted = false;
    
    public void startApp() {
        if (!midletStarted) {
            midletStarted = true;
            //Your code
        }
    }
    

    This way you can track midlet state changes. But in fact it is better that you don’t use this method at all and use constructor instead.

    Oh, by the way, I don’t think that there are some multiple instances or something like that, this is merely a JVM error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am very new to j2me. i have created a sample program, but i
I have a J2ME app running on my mobile phone(client), I would like to
We have a J2ME application that needs to read hex numbers. The application is
i have a j2me application , it does the File IO operation, but every
i have an Java J2ME application that does (at user request) create HttpConnections to
I have read in many places that network connection in a j2me app should
I have to develop a Java ME (formerly known as J2ME) application that will
I'm dealing with a midlet in j2me, and I have this thread class (say
I have a problem with an J2ME client app, that sends data to an
I have a problem setting up my maven j2me project that I created in

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.