导入包(自动)

1
import android.app.ProgressDialog;

声明全局变量

1
private ProgressDialog progressDialog;

显示对话框

1
progressDialog = ProgressDialog.show(this, "请稍等", "正在登录", true, false);

关闭对话框

1
2
if (progressDialog != null)
progressDialog.dismiss();