I have a interesting bug. When I create a开发者_如何学运维n com.sun.lwuit.Image
in Java ME, I receive an exception:
java.lang.IllegalStateException: No current display!
at com.sun.lwuit.Display.getImplementation: com.sun.lwuit.impl.LWUITImplementation getImplementation() (Display.java:437)
at com.sun.lwuit.Image.createImage: com.sun.lwuit.Image createImage(byte[],int,int) (Image.java:558)
As I suggest, according to the text exception, the image tries to bring himself on screen, but in code, I just simply don't reach to visualization.
In what may be the problem?
I found the solution myself. Bug occurred because I did not initialize graphics, like this:
Container container = arg0.getContainer();
container.setVisible(true);
Display.init(container);
Display.getInstance().setPureTouch(true);
精彩评论