我想在我使用 LWUIT 从 Web 服务加载一些数据时显示对话框,
以下是代码
public class LoaderAnimation extends Container implements Runnable {
private Thread t;
private boolean running = false;
public LoaderAnimation() {
}
public void start() {
running = true;
t = new Thread(this);
t.start();
}
public void run() {
while (running) {
// do something
t.sleep(150);
}
}
public void stop() {
running = false;
}
}
现在它运行但调用 Web 服务的代码停止工作会发生什么
这就是它的召唤
public static void showLoaderScreen ()
{
dialog = new Dialog();
dialog.setLayout(new BorderLayout());
canvas = new LoaderAnimation();
dialog.addComponent(BorderLayout.CENTER , canvas);
canvas.start();
dialog.show();
}
public static void dismissLoaderScreen ()
{
canvas.stop();
dialog.dispose();
}