我使用 ProgressDialog 向用户展示他必须等待,并在用户必须等待时使我的应用程序的表面“不可触碰”。我在 progressDialog 中添加了一个按钮,如果某些条件为真,它应该启动一些操作。问题是每次用户按下按钮时,progressDialog 都会自动关闭。即使没有触发任何动作。调用 onClick 时,如何防止 progressDialog 被解除?
谢谢和问候
编辑:
connectingDialog = new ProgressDialog(this);
connectingDialog.setCancelable(false);
connectingDialog.setCanceledOnTouchOutside(false);
connectingDialog.setButton(DialogInterface.BUTTON_NEUTRAL, "start", new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface arg0, int arg1) {
/*if(isPrepared)
startGame();*/
connectingDialog.show(); // does not work, too
}
});
connectingDialog.show();