/**
* 弹窗提示
* @param title 标题
* @param msg 内容
* @param secDelay 倒计时时间 秒
*/
public void Xy_ShowDialog(String title, String msg, int secDelay) {
AlertDialog dialog = new AlertDialog.Builder(MainActivity.
this).setTitle(title).
setMessage(msg).setCancelable(false)
.create();
dialog.show();
if (secDelay > 0) {
for (int i = 0; i < secDelay; i++) {
int finalI = i;
handler.postDelayed(() -> {
dialog.setTitle(title + " " + finalI + "秒");//在标题栏显示倒计时
}, (secDelay - i) * 1000L);
}
handler.postDelayed(dialog::dismiss, secDelay * 1000L);
}
}