@SuppressWarnings("static-access")
  @Override
  protected void onPostExecute(String result) {
    super.onPostExecute(result);
    this.result = result;

    LogUtils.d(result); // TODO

    if (!StringUtil.isEmptyString(result)) {
      try {
        this.jsonResult = MyGson.getInstance().fromJson(result, BaseResult.class);
      } catch (Exception e) {
        this.jsonResult = Constants.JSON_ERROR;
        e.printStackTrace();
      }
    } else {
      this.jsonResult = Constants.SERVER_ERROR;
    }
    try {
      JSONObject jo = new JSONObject(result).getJSONObject("resultParm");
      Map<String, String> map = new HashMap<String, String>();
      Iterator<String> keys = jo.keys();

      while (keys.hasNext()) {
        String k = keys.next();
        map.put(k, jo.getString(k));
      }
      this.jsonResult.setResultParam(map);
    } catch (Exception e) {
      e.printStackTrace();
    }
    if (dataReturnListener != null) {
      dataReturnListener.onDataReturn(Tasktag, jsonResult, result);
    }
  }
예제 #2
0
  @Override
  protected void onPostExecute(String json) {
    super.onPostExecute(json);

    BaseResult jsonResult = null;
    if (!StringUtil.isEmptyString(json)) {
      try {
        jsonResult = MyGson.getInstance().fromJson(json, BaseResult.class);
      } catch (Exception e) {
        jsonResult = Constants.JSON_ERROR;
        e.printStackTrace();
      }
    } else {
      jsonResult = Constants.SERVER_ERROR;
    }
    try {
      JSONObject jo = new JSONObject(json).getJSONObject("resultParm");
      Map<String, String> map = new HashMap<String, String>();
      Iterator<String> keys = jo.keys();

      while (keys.hasNext()) {
        String k = keys.next();
        map.put(k, jo.getString(k));
      }
      jsonResult.setResultParam(map);
    } catch (Exception e) {
      e.printStackTrace();
    }
    if (dataReturnListener != null) {
      dataReturnListener.onDataReturn(taskTag, jsonResult, json);
    }
  }