private void submit() {
dialog = ProgressDialog.show(this, "提示", "处理中..");
new AsyncTask() {
@Override
protected String doInBackground(String... params) {
String urlString = AppConstant.getUrl(getApplicationContext())
+ "ServletService";
Map<String, Object> map = new HashMap<String, Object>();
map.put("Action", "addfriend");
map.put("userid1", user.getId());
map.put("userid2", list.get(row).getId());
String result = httpHelper.HttpPost(urlString, map);
return result;
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
dialog.dismiss();
if (!TextUtils.isEmpty(result)) {
if (result.trim().equals("1")) {
toastUtil.show("添加成功,等待对方验证");
} else if (result.trim().equals("-1")) {
toastUtil.show("你已经添加对方为好友,等待对方审核");
} else if (result.trim().equals("-2")) {
toastUtil.show("对方拒绝你的请求");
} else if (result.trim().equals("-3")) {
toastUtil.show("你们已经是好友");
}
} else {
toastUtil.show("操作失败");
}
finish();
}
}.execute();
}
//因为安卓模拟器上运行的时候出bug,一点添加好友,就会提示程序已停止运行,然后自动退出,求大神指出哪里出了问题