我對Android編程頗爲陌生,所以請原諒我的愚蠢問題>,< 就像標題所說,我想在我的後面顯示AlertDialog/Toast ProgressDialog完成。我如何以正確的方式做到這一點?注意:我的處理程序僅用於解除ProgressDialog(pd.dismissDialog())。Android - 在ProgressDialog完成後顯示AlertDialog/Toast
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnDoRegister:
pd = ProgressDialog.show(RegisterActivity.this, "",
"Registering with the server..");
new Thread() {
public void run() {
Looper.prepare();
//(hopefully) thread-safe implementations here
handler.sendEmptyMessage(0);
}
}.start();
if (status == registered) {
//show AlertDialog/Toast here
finish();
} else if (status == notRegistered) {
//show AlertDialog/Toast here
}
break;
}
更重要的是混亂的是,當我試圖調試此,logcat的說明不了什麼,一切都運行完美(警報/敬酒顯示爲預期)。但是當我試圖正常運行時,不知何故,我覺得這運行得太快,並沒有正確顯示我的警報/吐司(聽起來很愚蠢)。非常感謝您的幫助。
k,在哪個線程中您解散進度對話框?只是顯示那個coe。 – user370305