我在 doInBackground() 方法中执行了一项耗时的任务,但在该方法中,我希望能够使用百分比数据更新 progressDialog。我怎样才能做到这一点?
class GetDataTask extends AsyncTask<Void, Void, Void> {
@Override
protected void onPreExecute()
{
mProgressDialog = ProgressDialog.show(getActivity(),Constants.APP_NAME,"Getting data", true);
}
@Override
protected Void doInBackground(Void... params)
{
//go get data, update mProgressDialog
return null;
}
@Override
protected void onPostExecute(Void res)
{
}
}