public void handleMessage(android.os.Message msg) { if (progressBar.isShowing()) progressBar.dismiss(); switch (msg.what) { case 0x0001: CustomToast.showToast(AdviceActivity.this, "提交成功", 2000); finish(); break; case 0x0002: CustomToast.showToast(AdviceActivity.this, "提交失败", 2000); break; } };
@Click(R.id.bt_activity_advice) public void sendAdvice() { if (mEditTextAdvice.getText().toString().equals("")) { CustomToast.showToast(AdviceActivity.this, "意见不能为空", 2000); return; } progressBar.show(); AVObject backAdvice = new AVObject("advice"); backAdvice.put("usernumb", Application.user.getId()); backAdvice.put("username", Application.user.getName()); backAdvice.put("From", Application.user.getFromData()); backAdvice.put("To", Application.user.getToData()); backAdvice.put("Department", Application.user.getDepartment()); backAdvice.put("advice", mEditTextAdvice.getText().toString()); backAdvice.saveInBackground( new SaveCallback() { @Override public void done(AVException e) { if (e == null) { handler.sendEmptyMessage(0x0001); } else { handler.sendEmptyMessage(0x0002); } } }); }