use of com.amap.api.services.geocoder.GeocodeSearch in project SmartMesh_Android by SmartMeshFoundation.
the class LoadDataService method onCreate.
@Override
public void onCreate() {
geocoderSearch = new GeocodeSearch(this);
geocoderSearch.setOnGeocodeSearchListener(this);
super.onCreate();
}
use of com.amap.api.services.geocoder.GeocodeSearch in project summer-android by cn-cerc.
the class ClockInActivity method setUpMap.
private void setUpMap() {
aMap.setMapType(3);
// 设置定位监听
aMap.setLocationSource(this);
// 设置默认定位按钮是否显示
aMap.getUiSettings().setMyLocationButtonEnabled(true);
// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
aMap.setMyLocationEnabled(true);
// 设置定位的类型为定位模式 ,可以由定位、跟随或地图根据面向方向旋转几种
aMap.setMyLocationType(1);
CameraPosition LUJIAZUI = new CameraPosition.Builder().target(new LatLng(22.579652, 113.861323)).zoom(17).bearing(0).tilt(45).build();
aMap.animateCamera(CameraUpdateFactory.newCameraPosition(LUJIAZUI));
setupLocationStyle();
aMap.setOnMapClickListener(this);
aMap.moveCamera(CameraUpdateFactory.zoomTo(18));
geocoderSearch = new GeocodeSearch(this);
geocoderSearch.setOnGeocodeSearchListener(this);
progDialog = new ProgressDialog(this);
}
use of com.amap.api.services.geocoder.GeocodeSearch in project KL2 by jweihao.
the class GaoDeActivity method getAddressInfoByLatLong.
/**
* 通过经纬度获取当前地址详细信息,逆地址编码
*
* @param latitude
* @param longitude
*/
private void getAddressInfoByLatLong(double latitude, double longitude) {
GeocodeSearch geocodeSearch = new GeocodeSearch(this);
/*
point - 要进行逆地理编码的地理坐标点。
radius - 查找范围。默认值为1000,取值范围1-3000,单位米。
latLonType - 输入参数坐标类型。包含GPS坐标和高德坐标。 可以参考RegeocodeQuery.setLatLonType(String)
*/
RegeocodeQuery query = new RegeocodeQuery(new LatLonPoint(latitude, longitude), 3000, GeocodeSearch.AMAP);
geocodeSearch.getFromLocationAsyn(query);
geocodeSearch.setOnGeocodeSearchListener(mOnGeocodeSearchListener);
}
use of com.amap.api.services.geocoder.GeocodeSearch in project YourEyes by SevenLJY.
the class MyLocationActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mylocation);
longitude = -1;
btn_getLocation = (Button) findViewById(R.id.btn_getLocation);
tv_location = (TextView) findViewById(R.id.tv_location);
et_destinationName = (EditText) findViewById(R.id.et_destinationName);
btn_toNavi = (Button) findViewById(R.id.btn_toNavi);
tv_destination = (TextView) findViewById(R.id.tv_destination);
dest_longitude = 0;
dest_latitude = 0;
//初始化定位和地址解析
initLocation();
search = new GeocodeSearch(this);
search.setOnGeocodeSearchListener(new GeocodeSearch.OnGeocodeSearchListener() {
@Override
public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i) {
// RegeocodeAddress addr = regeocodeResult.getRegeocodeAddress();
}
@Override
public void onGeocodeSearched(GeocodeResult geocodeResult, int i) {
GeocodeAddress addr = geocodeResult.getGeocodeAddressList().get(0);
LatLonPoint latlng = addr.getLatLonPoint();
dest_longitude = latlng.getLongitude();
dest_latitude = latlng.getLatitude();
String temp = "";
temp += "经度:" + dest_longitude + "\n";
temp += "纬度:" + dest_latitude + "\n";
tv_destination.setText(temp);
}
});
btn_getLocation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startLocation();
}
});
btn_toNavi.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
destinationName = et_destinationName.getText().toString().trim();
if (destinationName.equals("")) {
ToastUtil.show(MyLocationActivity.this, "请输入有效地址");
} else {
if (city != null) {
GeocodeQuery query = new GeocodeQuery(destinationName, city);
search.getFromLocationNameAsyn(query);
}
}
}
});
}
Aggregations