我想在我的活動中顯示progressDialog時,我調用webservices和調用web服務結束對話框自動解除任何知道如何做到這一點,我想爲它的一些示例。 Thankx提前。如何在Android中顯示progressDialog?
這裏是我的代碼,但它不工作的罰款
final ProgressDialog dialog = ProgressDialog.show(
RouteServicing.this, "", "Loading. Please wait...", true);
final Handler handler = new Handler() {
public void handleMessage(Message msg) {
dialog.dismiss();
}
};
Thread checkUpdate = new Thread() {
public void run() {
Status = cn.callWebService(url);
getDetail(Status);
//handler.sendEmptyMessage(0);
dialog.dismiss();
}
};
checkUpdate.start();
它表明我這個錯誤
02-02 16:06:53.219: E/WindowManager(1127): android.view.WindowLeaked: Activity com.palewar.coinop.RouteServicing has leaked window [email protected] that was originally added here
02-02 16:06:53.219: E/WindowManager(1127): at android.view.ViewRoot.<init>(ViewRoot.java:272)
02-02 16:06:53.219: E/WindowManager(1127): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
02-02 16:06:53.219: E/WindowManager(1127): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
02-02 16:06:53.219: E/WindowManager(1127): at android.view.Window$LocalWindowManager.addView(Window.java:424)
02-02 16:06:53.219: E/WindowManager(1127): at android.app.Dialog.show(Dialog.java:241)
02-02 16:06:53.219: E/WindowManager(1127): at android.app.ProgressDialog.show(ProgressDialog.java:107)
02-02 16:06:53.219: E/WindowManager(1127): at android.app.ProgressDialog.show(ProgressDialog.java:90)
02-02 16:06:53.219: E/WindowManager(1127): at com.palewar.coinop.RouteServicing.onClick(RouteServicing.java:243)
什麼不起作用?有關細節的更多信息不要太模糊。 – JoxTraex 2012-02-02 10:33:33
你在哪裏調用'show()'? – rds 2012-02-02 10:35:49