我的对话框打开并询问代码,但当用户切换到手机的消息框,通过最小化应用程序来查看代码。然后在恢复应用程序后,对话框消失。 我的应用无法恢复上一个UI状态。
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Enter Your Registeration Code");
alert.setMessage("Registeration code has been delivered on your registered number via sms");
// Set an EditText view to get user input
final EditText input = new EditText(this);
alert.setView(input);
alert.setCancelable(false);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
String value = input.getText().toString().trim();
String regsCode2 = etFake.getText().toString().trim();
if (value.compareToIgnoreCase(regsCode2) == 0) {
validCodeMatch = objCommonServices.sendEvalidCode(String.valueOf(mobileNo), password, "OK", regsCode2);
if (validCodeMatch.contains("Code Match")) {
showDialog(2);
}
} else {
try {
removeDialog(3);
showDialog(3);
} catch (Exception e) {
}
}
}
});