@Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_projectaccountdetail); super.onCreate(savedInstanceState); mClient = ProjectAccount_Detail_DBClient.get(mContext); if (mClient.isExist(pid)) getDataFromCache(); else { if (hasNetWork()) getDetailInfor(); else { XtomToastUtil.showShortToast(mContext, R.string.nonetwork); return; } } }
@Override protected void callBackForServerSuccess(int taskID, XtomNetTask netTask, BaseResult result) { switch (netTask.getId()) { case TaskConstant.GET_ACCOUNT_DETAIL: @SuppressWarnings("unchecked") MResult<AccountDetailInfor> base = (MResult<AccountDetailInfor>) result; layout.refreshSuccess(); infor = base.getObjects().get(0); mClient.insertOrUpdate(infor); managedata(); break; case TaskConstant.ADD_WITHDRAW: XtomToastUtil.showShortToast(mContext, result.getMsg()); switch (result.getStatus()) { case ServiceConstant.STATUS_SUCCESS: XtomToastUtil.showShortToast(mContext, result.getMsg()); finish(); break; case ServiceConstant.STATUS_FAILED: XtomToastUtil.showShortToast(mContext, result.getMsg()); break; } break; } super.callBackForServerSuccess(taskID, netTask, result); }
private void getDataFromCache() { infor = mClient.selectByPid(pid); layout.setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); managedata(); }