我无法构建我的项目,因为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"
}
}
那么我应该在哪里插入创建进度对话框的代码呢?