我的片段中有一个链接,显示“单击以打开对话框”,单击它后,会弹出一个警告对话框,显示“您要更改视图吗?” 带有是和否符号。如果我单击“否”,则不会发生任何事情,并且对话框会按预期消失。但是,如果我单击“是”,如何调用函数来刷新我的视图,直到刷新我的视图才会显示进度对话框?到目前为止,这是我的代码,我不知道在哪里关闭进度对话框或确保刷新视图,有什么线索吗?:
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Are you sure you want to refresh your view?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//refreshview here ?
ProgressDialog progressDialog = ProgressDialog.show(getActivity(), "",
"Loading. Please wait...", true);
progressDialog.show();
progressDialog.setCancelable(false);
progressDialog.setCanceledOnTouchOutside(false);
}
});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
AlertDialog dialog = builder.create();
dialog.show();