开发者

Java ME image exception

开发者 https://www.devze.com 2023-04-03 04:48 出处:网络
I have a interesting bug. When I create a开发者_如何学运维n com.sun.lwuit.Image in Java ME, I receive an exception:

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消