private void doSubmitSuccess(Object data) { String dataString = null; try { dataString = new String((byte[]) data, "UTF-8"); } catch (Exception e1) { e1.printStackTrace(); } try { PdaResponse<String> response = ResultCodeJsonParser.parserResultCodeJson(dataString); if (null != response && response.isSuccess()) { Intent intent = new Intent( RetrievePasswordAuthcodeActivity.this, RetrievePasswordSettingActivity.class); intent.putExtra("memberDto", retrieveInfo); startActivity(intent); } else { // 登录失败 try { String result = response.getMessage(); String message = result.substring(result.indexOf("#") + 1, result.length()); Message msg = myHandler.obtainMessage(); msg.what = SHOW_TOAST; msg.obj = message; myHandler.sendMessage(msg); } catch (Exception e) { e.printStackTrace(); ToastUtil.show(context, getResources().getString(R.string.network_error_hint)); } } } catch (Exception e) { e.printStackTrace(); } }
@Override public void onDataReceive(DataHandler dataHandler, int resultCode, Object data, int type) { myHandler.sendEmptyMessage(CLOSE_PROGRESS); switch (resultCode) { case NetWork.SUBMIT_REGISTER_AUTHCODE_OK: doSubmitSuccess(data); break; case NetWork.SUBMIT_REGISTER_AUTHCODE_ERROR: ToastUtil.show(context, getResources().getString(R.string.network_error_hint)); break; default: break; } }
public void handleMessage(android.os.Message msg) { switch (msg.what) { case SHOW_PROGRESS: showProgress(); break; case CLOSE_PROGRESS: dismissProgress(); break; case SHOW_TOAST: ToastUtil.show(context, msg.obj.toString()); break; default: break; } };