예제 #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);
    }
  }
예제 #2
0
  @Override
  public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
    // TODO Auto-generated method stub
    try {
      TextView txtView = (TextView) arg1;

      TextView txtSubTitle = (TextView) findViewById(R.id.txtSubTitle);
      txtSubTitle.setText(txtView.getText().toString() + " 이내의 사용자");

      distance = txtView.getText().toString().replaceAll("km", "");

      pageNo = 1;
      adapter.clear();

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

      inquiryList();
    } catch (Exception ex) {
      catchException(this, ex);
    }
  }