1

Why is my lwuit application running slowly on phones, and how can I fix it to perform better?

When I run the LwuitDemo, it is running fine. So maybe there is something missing in my code.

I use this when want to display a dialog:

 Display.getInstance().invokeAndBlock(new Runnable() {
            public void run() {
                Dialog.show("Add User/Flux", "Please enter the pin", "Ok", null);
            }
        });

And when I want to create and show a form

System.gc();
Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
NaPsTeR
  • 31
  • 4
  • I think the issue is on my lwuit ressource – NaPsTeR Sep 17 '12 at 07:56
  • When my I use the transparency on my form, Dialog or other field, the application is quite slow on my device not on a simulator, so I managed not to often using it or not using it at all... :) – NaPsTeR Sep 20 '12 at 13:30

1 Answers1

0

You must NEVER do that. Invoke and block opens a new thread while blocking the EDT which is the exact opposite of what you need to do.

You need to show dialogs on the EDT not the other way around e.g. using callSerially/AndWait.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
  • Thanks Shai... I usually use callSerially but due of the issue I had I change my code many time in other to find out the solution. and I finally got the solution on the ressource. – NaPsTeR Sep 25 '12 at 04:29