我无法构建我的项目,因为 Eclipse 给出错误
这是开始下载的按钮单击事件
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ProgressDialog mProgressDialog;
mProgressDialog = new ProgressDialog(Test.this);
mProgressDialog.setMessage("Pobieranie");
mProgressDialog.setIndeterminate(false);
mProgressDialog.setMax(100);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
DownloadFile downloadFile = new DownloadFile();
downloadFile.execute("http://google.com");
}
});
和 AsyncTask 函数
private class DownloadFile extends AsyncTask<String, Integer, String> {
[...]
@Override
protected void onPreExecute() {
super.onPreExecute();
mProgressDialog.show(); // Here eclipse tell that "mProgressDialog cannot be resolved"
}
@Override
protected void onProgressUpdate(Integer... progress) {
super.onProgressUpdate(progress);
mProgressDialog.setProgress(progress[0]); // Here eclipse tell that "mProgressDialog cannot be resolved"
}
}
那么我应该在哪里插入创建我的进度对话框的代码?