0
我的应用程序仍在显示处理状态,但我转到另一个屏幕并注销仍在处理的进程对话框没有停止它。登录后和注销时,进程对话框不会停止
当我按在登录页面登录按钮,我用这个代码:
btnLogin.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
showProgress();
postLoginData();
}
});
public void postLoginData() {
if (pin.getTextSize() == 0 || mobile.getTextSize() == 0) {
AlertDialog.Builder altDialog = new AlertDialog.Builder(this);
altDialog.setMessage("Please Enter Complete Information!");
} else {
Intent i = new Intent(this.getApplicationContext(),
AgAppMenu.class);
Bundle bundle = new Bundle();
bundle.putString("mno", mobile.getText().toString());
bundle.putString("pinno", pin.getText().toString());
i.putExtras(bundle);
startActivity(i);
}
}
private void showProgress() {
myProgressDialog = ProgressDialog.show(LoginScreen.this, null, "Processing please wait...", true);
}
如果我使用myProgressDialog.dismiss() 在此位置 意图I =新意图(this.getApplicationContext(),AgAppMenu.class); \t \t \t Bundle bundle = new Bundle(); \t \t \t bundle.putString(“mno”,mobile.getText()。toString()); \t \t \t bundle.putString(“pinno”,pin.getText()。toString()); \t \t \t \t \t i.putExtras(bundle); \t \t \t myProgressDialog.dismiss(); \t \t \t startActivity(i); processdailog没有显示 –
因为它太快了,showProgress();然后myProgressDialog.dismiss(); ,或者你可以使用postDelayed在一定时间后关闭它。 –
带有Runnable的处理程序'postDelayed'可在一定的时间内解除它。 –