Exemplo n.º 1
0
  /** 点击地图后走这 */
  @Override
  public void onRegeocodeSearched(RegeocodeResult result, int rCode) {
    // dismissDialog();
    if (rCode == 0) {
      if (result != null
          && result.getRegeocodeAddress() != null
          && result.getRegeocodeAddress().getFormatAddress() != null) {
        addressName = result.getRegeocodeAddress().getFormatAddress();
        String cityString = result.getRegeocodeAddress().getCity();
        if (cityString.equals("")) cityString = result.getRegeocodeAddress().getProvince();
        locationCity = cityString;
        getActionBar().setTitle(locationCity);
        address = addressName;
        addressTv.setText(address);
      } else {
        Utils.toast(GaodeMapActivity.this, "无此地址");
      }
    } else if (rCode == 27) {
      Utils.toast(GaodeMapActivity.this, "网络有问题");
    } else if (rCode == 32) {
      Utils.toast(GaodeMapActivity.this, "key有问题");
    } else {

      Utils.toast(GaodeMapActivity.this, rCode + "");
    }
  }
Exemplo n.º 2
0
  @Override
  public void onPoiSearched(PoiResult result, int rCode) {
    dismissDialog();
    if (rCode == 0) {
      if (result != null && result.getQuery() != null) { // 搜索poi的结果
        mSearchList.clear();
        for (int i = 0; i < result.getPois().size(); i++) {
          mSearchList.add(result.getPois().get(i).getTitle());
        }
        mSearchAdapter.notifyDataSetChanged();

      } else {
        Utils.toast(GaodeMapActivity.this, "对不起,没有搜索到相关数据!");
      }
    } else if (rCode == 27) {
      Utils.toast(GaodeMapActivity.this, "搜索失败,请检查网络连接!");
    } else if (rCode == 32) {
      Utils.toast(GaodeMapActivity.this, "key验证无效!");
    } else {
      Utils.toast(GaodeMapActivity.this, getString(R.string.error_other) + rCode);
    }
  }