예제 #1
0
 @Override
 public void onLocationChanged(AMapLocation amapLocation) {
   if (amapLocation != null && amapLocation.getAMapException().getErrorCode() == 0) {
     // get geoinfo
     Double lati = amapLocation.getLatitude();
     Double logti = amapLocation.getLongitude();
     String address = amapLocation.getAddress();
     String province = amapLocation.getProvince();
     String country = amapLocation.getCountry();
     String city = amapLocation.getCity();
     String citycode = amapLocation.getCityCode();
     String district = amapLocation.getDistrict();
     String street = amapLocation.getStreet();
     float Accuracy = amapLocation.getAccuracy();
     String road = amapLocation.getRoad();
     geo.setLatitude(lati);
     geo.setLongitude(logti);
     geo.setAddress(address);
     geo.setProvince(province);
     geo.setCountry(country);
     geo.setCity(city);
     geo.setCitycode(citycode);
     geo.setDistrict(district);
     geo.setStreet(street);
     geo.setAccuracy(Accuracy);
     geo.setRoad(road);
     LogUtil.v(
         "Location info: ",
         lati + " " + logti + " " + address + " " + province + " " + country + " " + city + " "
             + citycode + " " + district + " " + street + " " + Accuracy + " " + road);
     loadNear();
   } else {
     this.stopLocation();
     onLoad();
     this.mTexthint.setClickable(true);
     this.mTexthint.setText(getString(R.string.get_no_position));
     LogUtil.v("NearFragment info: ", "enter onLocationChanged() + ERROR!");
     LogUtil.v(
         "NearFragment info : AmapErr",
         "Location ERR:" + amapLocation.getAMapException().getErrorCode());
   }
 }
예제 #2
0
 @Override
 public void onLocationChanged(AMapLocation amapLocation) {
   LogUtil.v(
       "MessboardActivity info: ", "enter onLocationChanged()!" + amapLocation.getLatitude());
   if (amapLocation != null && amapLocation.getAMapException().getErrorCode() == 0) {
     LogUtil.v("MessboardActivity info: ", "enter onLocationChanged()!" + " enter IF!");
     // get geoinfo
     Double lati = amapLocation.getLatitude();
     Double logti = amapLocation.getLongitude();
     String address = amapLocation.getAddress();
     String province = amapLocation.getProvince();
     String country = amapLocation.getCountry();
     String city = amapLocation.getCity();
     String citycode = amapLocation.getCityCode();
     String district = amapLocation.getDistrict();
     String street = amapLocation.getStreet();
     float Accuracy = amapLocation.getAccuracy();
     String road = amapLocation.getRoad();
     geo.setLatitude(lati);
     geo.setLongitude(logti);
     geo.setAddress(address);
     geo.setProvince(province);
     geo.setCountry(country);
     geo.setCity(city);
     geo.setCitycode(citycode);
     geo.setDistrict(district);
     geo.setStreet(street);
     geo.setAccuracy(Accuracy);
     geo.setRoad(road);
     LogUtil.v(
         "Location info: ",
         lati + " " + logti + " " + address + " " + province + " " + country + " " + city + " "
             + citycode + " " + district + " " + street + " " + Accuracy + " " + road);
     this.calculateDistance(lati, logti);
   } else {
     LogUtil.v("MessboardActivity info: ", "enter onLocationChanged() + ERROR!");
     Log.e("AmapErr", "Location ERR:" + amapLocation.getAMapException().getErrorCode());
   }
 }