【发布时间】:2014-09-09 14:21:29
【问题描述】:
我试图在 Fragment 类中显示 ProgressDialog。以下代码仅适用于 Activity 类,但不适用于 Fragment。有人可以帮我解决这个问题吗,为什么这个 ProgressDialog 实现只适用于 Activity 而不适用于 Fragment?
private class ProcessUpdateProfile extends
AsyncTask<String, String, JSONObject> {
private ProgressDialog nDialog;
@Override
protected void onPreExecute() {
super.onPreExecute();
nDialog = new ProgressDialog(PFragment.this); //Here I get an error: The constructor ProgressDialog(PFragment) is undefined
nDialog.setMessage("Loading..");
nDialog.setTitle("Checking Network");
nDialog.setIndeterminate(false);
nDialog.setCancelable(true);
nDialog.show();
}
}
【问题讨论】:
标签: android android-fragments progressdialog