【发布时间】:2011-03-24 10:12:14
【问题描述】:
我想在我的应用程序中加载屏幕,以便它在互联网连接启动时出现,而当我从 web 服务获取数据时加载屏幕隐藏。
我曾尝试使用 .gif 文件。它在我制作的仅显示 .gif 文件的简单应用程序中正常工作。但是当我将此代码与我的 applicationj 集成时,它会显示错误。
错误是:
TRACE: <at java.lang.IllegalArgumentException>, Exception caught in Display class
java.lang.IllegalArgumentException
at javax.microedition.media.Manager.createPlayer(), bci=8
at com.semaphore.GifCanvas.<init>(GifCanvas.java:41)
at com.semaphore.CompanySplashScreen.dismiss(CompanySplashScreen.java:89)
at com.semaphore.CompanySplashScreen.keyPressed(CompanySplashScreen.java:78)
at javax.microedition.lcdui.CanvasLFImpl.uCallKeyPressed(), bci=19
at javax.microedition.lcdui.DisplayableLFImpl.uCallKeyEvent(), bci=146
at javax.microedition.lcdui.Display$DisplayEventConsumerImpl.handleKeyEvent(), bci=30
at com.sun.midp.lcdui.DisplayEventListener.process(), bci=277
at com.sun.midp.events.EventQueue.run(), bci=179
at java.lang.Thread.run(Thread.java:619)
我用来执行 .gif 文件的代码是:-
InputStream ins = getClass().getResourceAsStream("/loading.gif");
try {
player = Manager.createPlayer(ins, "image/gif");
player.prefetch();
player.setLoopCount(10);
player.start();
} catch (IOException ex) {
ex.printStackTrace();
} catch (MediaException ex) {
ex.printStackTrace();
}
if ((vidc = (VideoControl) player.getControl("VideoControl")) != null)
vidc.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
try {
vidc.setDisplayLocation(2, 2);
vidc.setDisplaySize(getWidth()/2,getHeight()/2);
}
catch (MediaException me) {}
vidc.setVisible(true);
我该如何解决这个问题?
【问题讨论】:
标签: java-me