我只想在我的Lwuit J2ME应用程序中解析一些Xml时显示加载屏幕。 我看到有很多例子,如滑块和仪表,我发现这个简单的代码,但我不知道如何在解析操作时显示对话框。 如果我使用了dialog.showDialog();它会阻止UI
passenger p = new passenger();
p.start();
synchronized (p) {
System.out.println("passenger is waiting for the bus ");
try {
p.wait();
} catch (InterruptedException ex) {
ex.printStackTrace();
}
System.out.println("passenger got notification");
// I think that i must use the loading thing here but i don't know
// what to do.
}
System.out.println("after "+p.total+" time");
class passenger extends Thread {
int total = 0;
public void run() {
synchronized (this) {
System.out.println("wait .... ");
for (int i = 0; i <= 3000; i++){
total = total + i;
System.out.println(total+"");
}
System.out.println("passenger is given notification call");
notify();
}
}
答案 0 :(得分:3)
您需要在后台线程中进行解析,然后在完成后处理对话框。