Esempio n. 1
0
  @Override
  public void doPostTransaction(int requestCode, Object result) {
    // TODO Auto-generated method stub

    findViewById(R.id.marker_progress).setVisibility(ViewGroup.GONE);

    if (Constants.FAIL.equals(result)) {
      showOKDialog("통신중 오류가 발생했습니다.\r\n다시 시도해 주십시오.", null);
      return;
    }

    super.doPostTransaction(requestCode, result);

    listMain.setVisibility(ViewGroup.VISIBLE);

    try {
      APIResponse response =
          mapper.readValue(result.toString(), new TypeReference<APIResponse>() {});

      if ("0000".equals(response.getResCode())) {
        if (requestCode == HTTP_GET_USERS_NEAR_HERE) {
          adapter.remove(moreFlag);

          String postData = mapper.writeValueAsString(response.getData());
          List<User> userList = mapper.readValue(postData, new TypeReference<List<User>>() {});

          String moreFlagString = response.getData2().toString().split("\\|")[0];
          String totalCount = response.getData2().toString().split("\\|")[1];

          if ("true".equals(moreFlagString)) {
            userList.add(moreFlag);
          }

          adapter.addAll(userList);
          adapter.notifyDataSetChanged();

          TextView txtSubTitle = (TextView) findViewById(R.id.txtSubTitle);
          txtSubTitle.setText(distance + "km 이내의 사용자(" + totalCount + "명)");
        }
      }
    } catch (Exception ex) {
      catchException(this, ex);
    }
  }