当我单击“是”按钮时,我正在尝试关闭警报。按钮界面在大约 10 秒内执行一个过程。我想在单击按钮时关闭警报对话框,因为仅在 SaveRoute 方法完成时才关闭警报。我的代码:
imageRouteDetSave.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
//** Save the current route
new Thread(new Runnable() {
public void run() {
MyActivity.this.runOnUiThread(new Runnable() {
public void run() {
alertDialog = new AlertDialog.Builder(MyActivity.this).create();
alertDialog.setTitle("Saving...");
alertDialog.setMessage("......");
alertDialog.setButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
alertDialog.dismiss(); //-- No close the dialog
SaveRoute();//-- Big proccess
}
});