对于 AsyncTask 在下面写下你想从哪里开始任务
new asnktask(youractivity.this).execute();
并写这个类
private class asnktask extends AsyncTask<Void, Void, Integer> {
private Context context;
private ProgressDialog mProgressDialog;
public asnktask(Context _context) {
context =_context;
}
@Override
protected void onPreExecute() {
mProgressDialog = new ProgressDialog(this.context);
mProgressDialog.setMessage("Loading wait.....");
mProgressDialog.setIndeterminate(true);
mProgressDialog.setCancelable(true);
mProgressDialog.show();
}
@Override
protected Integer doInBackground(Void... params) {
//Do stuff of getting web service response
return 1;
}
@Override
protected void onPostExecute(Integer result) {
mProgressDialog.dismiss();
}
}
//完毕!!!!!!!!