1

我只想在我的 Lwiit J2ME 应用程序中解析一些 Xml 时显示加载屏幕。我看到有很多例子,例如滑块和仪表,我找到了这个简单的代码,但我不知道如何在解析操作时显示对话框。如果我使用 dialog.showDialog(); 它会阻止用户界面

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();
            }
    }
4

1 回答 1

3

您需要在后台线程中进行解析,然后在完成后处理对话框。

于 2012-09-06T12:48:52.137 回答