0

I have got a problem with my MIDlet application.

Whenever I execute this MIDlet the emulator shows the error: 'This application does not use the screen, and runs in background'.

So far I know that we have to give the reference of the screen to the instance of the Display, for that I did this:

  private Display display;

  display = Display.getDisplay(this);

Still I am facing the above error. please help me with this

gnat
  • 6,213
  • 108
  • 53
  • 73
Shreyas
  • 83
  • 1
  • 9
  • 1
    Since pygorex1 answer wasn't enough, it is time to post the source code of your MIDlet, unless you can find the issue by simply looking at the HelloWorld code provided with the J2ME emulator. – michael aubert Dec 08 '09 at 11:17

2 Answers2

1

Not only do you need to initialize the display you also need to set the current form:

mainForm= new Form("My Form");
display = Display.getDisplay(this);
display.setCurrent(mainForm);
leepowers
  • 37,828
  • 23
  • 98
  • 129
1

Check your commandAction parameter for Displayable's variable. If you give Displayable and Display the same variable, then you get the above error. Often, Display and Displayable are given "d" as the variable name which causes a problem.

Frosted
  • 11
  • 1