我想完全隐藏在执行 AsyncTask 期间显示的进度圈(下面的代码) - 同时显示进度对话框。问题是可以通过透明的进度对话框看到圆圈。有人可以帮忙吗?我不想改变进度对话框的透明度......
new AsyncTask<String, Void, List<Product>>() {
private ProgressDialog dialog;
protected void onPreExecute() {
this.dialog = ProgressDialog.show(getActivity(), "Progress", "Retrieving products...", false, false);
}
protected void onPostExecute(List<Product> result) {
// populate the list
Context context = getSherlockActivity().getApplicationContext();
ArrayAdapter<Product> adapter = new ArrayAdapter<Product>(context, R.layout.productlist_item, result);
setListAdapter(adapter);
// dismiss the progress dialog
dialog.dismiss();
}
@Override
protected List<Product> doInBackground(String... params) {
// populate the database if required
try {
// get the data from the server
MyApplication.populateProductDatabase(false);
} catch (NotConnectedToInternetException e) {
exceptionMessage = "Unable to retrieve data. Internet connection unavailable.";
e.printStackTrace();
}
// get the records in the database
ProductDAO dao = new ProductDAO();
List<Product> result = dao.getProducts(params[0]);
return result;
}
}.execute(find);