在运行“runmods(activity);”之前尝试让 alertdialog2 显示时遇到问题
按下按钮后,它不会显示 alertdialog2 并立即运行“runmods”
我想要的是能够按“执行”,然后显示 alertdialog2,然后runmods 运行。
public static void execute(final MainActivity activity) {
Rooted.rooted(activity);
AlertDialog alertDialog = new AlertDialog.Builder(activity).create();
final AlertDialog alertDialog2 = new AlertDialog.Builder(activity).create();
alertDialog.setTitle("Confirm");
alertDialog.setMessage("Are you sure you want to execute and reboot?");
alertDialog2.setTitle("Executing");
alertDialog2.setMessage("Your phone will now reboot");
alertDialog.setButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
alertDialog2.setOnShowListener(new AlertDialog.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
runmods(activity);
}
});
alertDialog2.show();
}
});
alertDialog.setButton2("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
});
alertDialog.show();
}