protected void onfailure(final AsyncTaskPayload payload, String errString) { if (!(payload.getResponse() instanceof ErrorResponse)) { if (errString == null) { er = new ErrorResponse("数据加载出错,请稍后再试.."); } else { er = new ErrorResponse(errString); if (!errString.contains("html")) { Toast.makeText(mContext.getApplicationContext(), errString, Toast.LENGTH_LONG).show(); } } payload.setResponse(er); } if (mListener != null) mListener.onFailed(payload.getTaskType(), payload.getResponse()); dismisDialog(); }
protected boolean checkErrorResponse( final AsyncTaskPayload payload, BaseResponse response, boolean isShow) { if (response instanceof ErrorResponse) { if (StringUtils.isEmpty(response.getVerification())) { if (response.getResult() != 10047 && response.getResult() != 10) { if (isShow && !StringUtils.isEmpty(response.getMsg())) { Toast.makeText(mContext.getApplicationContext(), response.getMsg(), Toast.LENGTH_LONG) .show(); } } } payload.setResponse(response); Log.e("error:" + response.getResult(), response.getMsg() + ""); onfailure(payload, response.getMsg()); return true; } if (response.getStatus() == 0) { onfailure(payload, response.getMsg()); return true; } return false; }