本文整理汇总了Java中com.amap.api.location.AMapLocation.getStreet方法的典型用法代码示例。如果您正苦于以下问题:Java AMapLocation.getStreet方法的具体用法?Java AMapLocation.getStreet怎么用?Java AMapLocation.getStreet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amap.api.location.AMapLocation
的用法示例。
在下文中一共展示了AMapLocation.getStreet方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onLocationChanged
import com.amap.api.location.AMapLocation; //导入方法依赖的package包/类
/**
* 实现定位
* @param amapLocation
*/
@Override
public void onLocationChanged(AMapLocation amapLocation) {
if (mListener != null && amapLocation != null) {
if (amapLocation != null
&&amapLocation.getErrorCode() == 0) {
if(isFirstTime){//只要第一次的数据,当然,也可以在这里关闭定位
// mlocationClient.stopLocation();//停止定位
mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
lvHolder.title = "[位置]";
lvHolder.address = amapLocation.getProvider()+amapLocation.getCity()+amapLocation.getStreet()+amapLocation.getStreetNum();
lvHolder.lp = new LatLonPoint(amapLocation.getLatitude(),amapLocation.getLongitude());
mEndMarker.setPosition(new LatLng(amapLocation.getLatitude(),amapLocation.getLongitude()));
data.add(0,lvHolder);
doSearchQuery();
}
} else {
String errText = "定位失败," + amapLocation.getErrorCode()+ ": " + amapLocation.getErrorInfo();
Log.e("AmapErr",errText);
}
}
}
示例2: onLocationChanged
import com.amap.api.location.AMapLocation; //导入方法依赖的package包/类
/**
* 定位成功后回调函数
*/
@Override
public void onLocationChanged(AMapLocation aLocation) {
if (mListener != null && aLocation != null) {
mListener.onLocationChanged(aLocation);// 显示系统小蓝点
marker.setPosition(new LatLng(aLocation.getLatitude(), aLocation
.getLongitude()));// 定位雷达小图标
float bearing = aMap.getCameraPosition().bearing;
aMap.setMyLocationRotateAngle(bearing);// 设置小蓝点旋转角度
aMap.getMinZoomLevel();
if(this.aLocation == null || this.aLocation.getStreet() != aLocation.getStreet())
{
this.aLocation = aLocation;
LatLng latng = new LatLng(aLocation.getLatitude(),aLocation.getLongitude());
// marker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 1)
// .icon(BitmapDescriptorFactory.fromResource(R.drawable.point))
// .position(latng).title("我的位置:"+this.aLocation.getCity()+this.aLocation.getDistrict()+this.aLocation.getRoad()));
marker.setPosition(latng);
marker.setTitle("我的位置:"+this.aLocation.getCity()+this.aLocation.getDistrict()+this.aLocation.getRoad());
marker.showInfoWindow();
}
}
}
示例3: onLocationChanged
import com.amap.api.location.AMapLocation; //导入方法依赖的package包/类
/**
* 定位成功后回调函数
*/
@Override
public void onLocationChanged(AMapLocation aLocation) {
if (mListener != null && aLocation != null) {
mListener.onLocationChanged(aLocation);// 显示系统小蓝点
marker.setPosition(new LatLng(aLocation.getLatitude(), aLocation
.getLongitude()));// 定位雷达小图标
if(this.aLocation == null || this.aLocation.getStreet() != aLocation.getStreet())
{
if(this.aLocation == null ||this.aLocation.getRoad() != aLocation.getRoad())
{
this.aLocation = aLocation;
startTextView.setText(this.aLocation.getCity()+this.aLocation.getDistrict()+this.aLocation.getRoad());
}
this.aLocation = aLocation;
LatLng latng = new LatLng(aLocation.getLatitude(),aLocation.getLongitude());
marker.setPosition(latng);
marker.setTitle("我的位置:"+this.aLocation.getCity()+this.aLocation.getDistrict()+this.aLocation.getRoad());
// marker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 1)
// .icon(BitmapDescriptorFactory.fromResource(R.drawable.point))
// .position(latng).title("我的位置:"+this.aLocation.getCity()+this.aLocation.getDistrict()+this.aLocation.getRoad()));
marker.showInfoWindow();
}
float bearing = aMap.getCameraPosition().bearing;
aMap.setMyLocationRotateAngle(bearing);// 设置小蓝点旋转角度
}
}
示例4: onLocationChanged
import com.amap.api.location.AMapLocation; //导入方法依赖的package包/类
/**
* 定位成功后回调函数
*/
@Override
public void onLocationChanged(AMapLocation amapLocation) {
MyAmapLocation =amapLocation;
if (amapLocation != null) {
if (amapLocation.getErrorCode() == 0) {
//定位成功回调信息,设置相关消息
amapLocation.getLocationType();//获取当前定位结果来源,如网络定位结果,详见官方定位类型表
amapLocation.getLatitude();//获取纬度
amapLocation.getLongitude();//获取经度
amapLocation.getAccuracy();//获取精度信息
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
Date date = new Date(amapLocation.getTime());
df.format(date);//定位时间
amapLocation.getAddress();//地址,如果option中设置isNeedAddress为false,则没有此结果,网络定位结果中会有地址信息,GPS定位不返回地址信息。
amapLocation.getCountry();//国家信息
amapLocation.getProvince();//省信息
amapLocation.getCity();//城市信息
amapLocation.getDistrict();//城区信息
amapLocation.getStreet();//街道信息
amapLocation.getStreetNum();//街道门牌号信息
amapLocation.getCityCode();//城市编码
amapLocation.getAdCode();//地区编码
// 如果不设置标志位,此时再拖动地图时,它会不断将地图移动到当前的位置
aMap.moveCamera(CameraUpdateFactory.zoomTo(17)); //设置缩放级别
aMap.moveCamera(CameraUpdateFactory.changeLatLng(new LatLng(amapLocation.getLatitude(), amapLocation.getLongitude())));//将地图移动到定位点
mListener.onLocationChanged(amapLocation);//点击定位按钮 能够将地图的中心移动到定位点
//aMap.addMarker(getMarkerOptions(amapLocation));//添加图钉
StringBuffer buffer = new StringBuffer();//获取定位信息
buffer.append(amapLocation.getCountry() + "" + amapLocation.getProvince() + "" + amapLocation.getCity() + "" + amapLocation.getProvince() + "" + amapLocation.getDistrict() + "" + amapLocation.getStreet() + "" + amapLocation.getStreetNum());
Toast.makeText(getApplicationContext(), buffer.toString(), Toast.LENGTH_LONG).show();
} else {
//显示错误信息ErrCode是错误码,errInfo是错误信息,详见错误码表。
Log.e("AmapError", "location Error, ErrCode:"
+ amapLocation.getErrorCode() + ", errInfo:"
+ amapLocation.getErrorInfo());
Toast.makeText(getApplicationContext(), "定位失败", Toast.LENGTH_LONG).show();
}
}
}
示例5: onLocationChanged
import com.amap.api.location.AMapLocation; //导入方法依赖的package包/类
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
if (aMapLocation != null) {
if (aMapLocation.getErrorCode() == 0) {
//可在其中解析amapLocation获取相应内容。
// aMapLocation.getLocationType();//获取当前定位结果来源,如网络定位结果,详见定位类型表
double latitude = aMapLocation.getLatitude();//获取纬度
double longitude = aMapLocation.getLongitude();//获取经度
aMapLocation.getAccuracy();//获取精度信息
aMapLocation.getAddress();//地址,如果option中设置isNeedAddress为false,则没有此结果,网络定位结果中会有地址信息,GPS定位不返回地址信息。
aMapLocation.getCountry();//国家信息
String province = aMapLocation.getProvince();//省信息
String city = aMapLocation.getCity();//城市信息
String district = aMapLocation.getDistrict();//城区信息
aMapLocation.getStreet();//街道信息
aMapLocation.getStreetNum();//街道门牌号信息
aMapLocation.getCityCode();//城市编码
aMapLocation.getAdCode();//地区编码
aMapLocation.getAoiName();//获取当前定位点的AOI信息
aMapLocation.getBuildingId();//获取当前室内定位的建筑物Id
aMapLocation.getFloor();//获取当前室内定位的楼层
Log.d("map", "onLocationChanged: " + aMapLocation.toString());
//获取定位时间
@SuppressLint("SimpleDateFormat") SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date(aMapLocation.getTime());
df.format(date);
LocationEntity locationEntity = new LocationEntity();
locationEntity.setProvince(province);
locationEntity.setPosLng(String.valueOf(longitude));
locationEntity.setPosLat(String.valueOf(latitude));
locationEntity.setCity(city);
locationEntity.setDistrict(district);
mSendLocation.sendLocation(locationEntity);
} else {
mSendLocation.sendLocation(null);
//定位失败时,可通过ErrCode(错误码)信息来确定失败的原因,errInfo是错误信息,详见错误码表。
Log.e("AmapError", "location Error, ErrCode:"
+ aMapLocation.getErrorCode() + ", errInfo:"
+ aMapLocation.getErrorInfo());
}
} else {
mSendLocation.sendLocation(null);
}
if (mLocationClient.isStarted()){
mLocationClient.stopLocation();
}
}
示例6: onLocationChanged
import com.amap.api.location.AMapLocation; //导入方法依赖的package包/类
@Override
public void onLocationChanged(AMapLocation amapLocation) {
if (amapLocation != null) {
if (amapLocation.getErrorCode() == 0) {
//定位成功回调信息,设置相关消息
amapLocation.getLocationType();//获取当前定位结果来源,如网络定位结果,详见官方定位类型表
mLatitude = amapLocation.getLatitude();//获取纬度
mLongitude = amapLocation.getLongitude();//获取经度
amapLocation.getAccuracy();//获取精度信息
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date(amapLocation.getTime());
df.format(date);//定位时间
amapLocation.getAddress();//地址,如果option中设置isNeedAddress为false,则没有此结果,网络定位结果中会有地址信息,GPS定位不返回地址信息。
amapLocation.getCountry();//国家信息
amapLocation.getProvince();//省信息
mCity = amapLocation.getCity();//城市信息
amapLocation.getDistrict();//城区信息
amapLocation.getStreet();//街道信息
amapLocation.getStreetNum();//街道门牌号信息
amapLocation.getCityCode();//城市编码
amapLocation.getAdCode();//地区编码
titleCenterTv.setText(amapLocation.getCity());
lp = new LatLonPoint(mLongitude, mLatitude);
Log.i(LOG, ">>>>> " + mCity + ", " + mLongitude + ", " + mLatitude);
// 如果不设置标志位,此时再拖动地图时,它会不断将地图移动到当前的位置
if (isFirstLoc) {
//设置缩放级别
aMap.moveCamera(CameraUpdateFactory.zoomTo(17));
//将地图移动到定位点
aMap.moveCamera(CameraUpdateFactory.changeLatLng(new LatLng(amapLocation.getLatitude(), amapLocation.getLongitude())));
//点击定位按钮 能够将地图的中心移动到定位点
mListener.onLocationChanged(amapLocation);
//添加图钉
mMarker = aMap.addMarker(getMarkerOptions(amapLocation));
isFirstLoc = false;
}
} else {
//显示错误信息ErrCode是错误码,errInfo是错误信息,详见错误码表。
Log.e("AmapError", "location Error, ErrCode:"
+ amapLocation.getErrorCode() + ", errInfo:"
+ amapLocation.getErrorInfo());
Toast.makeText(FindMapAroundAty.this, "定位失败", Toast.LENGTH_LONG).show();
}
}
}
示例7: onLocationChanged
import com.amap.api.location.AMapLocation; //导入方法依赖的package包/类
/**
* 定位成功后回调函数
*/
@Override
public void onLocationChanged(AMapLocation aLocation) {
activate(mListener);
if (mListener != null && aLocation != null) {
mListener.onLocationChanged(aLocation);// 显示系统小蓝点
// marker.setPosition(new LatLng(aLocation.getLatitude(), aLocation
// .getLongitude()));// 定位雷达小图标
if(this.aLocation == null || this.aLocation.getStreet() != aLocation.getStreet())
{
this.aLocation = aLocation;
}
// latLonPoint= new LatLonPoint(latng.latitude, latng.longitude);
// getAddress(latLonPoint);
// if(addressName!=null)
// {
// myAddressName=this.addressName;
//// marker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 1)
//// .icon(BitmapDescriptorFactory.fromResource(R.drawable.point))
//// .position(latng).title("我的位置:"+this.aLocation.getCity()+this.aLocation.getDistrict()+this.aLocation.getRoad()));
//
// marker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f)
// .icon(BitmapDescriptorFactory
// .defaultMarker(BitmapDescriptorFactory.HUE_BLUE))
// .position(latng)
// .title("我的位置:"+myAddressName));
// }
// else
LatLng latng = new LatLng(aLocation.getLatitude(),aLocation.getLongitude());
aMap.moveCamera(CameraUpdateFactory
.newCameraPosition(new CameraPosition( latng, 16f, 38.5f, 30000)));
marker.setPosition(latng);
marker.setTitle("我的位置:"+this.aLocation.getCity()+this.aLocation.getDistrict()+this.aLocation.getRoad());
// marker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 1)
// .icon(BitmapDescriptorFactory.fromResource(R.drawable.point))
// .position(latng).title("我的位置:"+this.aLocation.getCity()+this.aLocation.getDistrict()+this.aLocation.getRoad()));
marker.showInfoWindow();
float bearing = aMap.getCameraPosition().bearing;
aMap.setMyLocationRotateAngle(bearing);// 设置小蓝点旋转角度
}
deactivate();
}
示例8: onLocationChanged
import com.amap.api.location.AMapLocation; //导入方法依赖的package包/类
/**
* 定位成功后回调函数
*/
@Override
public void onLocationChanged(AMapLocation aLocation) {
activate(mListener);
if (mListener != null && aLocation != null) {
mListener.onLocationChanged(aLocation);// 显示系统小蓝点
// marker.setPosition(new LatLng(aLocation.getLatitude(), aLocation
// .getLongitude()));// 定位雷达小图标
if(this.aLocation == null || this.aLocation.getStreet() != aLocation.getStreet())
{
this.aLocation = aLocation;
}
// latLonPoint= new LatLonPoint(latng.latitude, latng.longitude);
// getAddress(latLonPoint);
// if(addressName!=null)
// {
// myAddressName=this.addressName;
//// marker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 1)
//// .icon(BitmapDescriptorFactory.fromResource(R.drawable.point))
//// .position(latng).title("我的位置:"+this.aLocation.getCity()+this.aLocation.getDistrict()+this.aLocation.getRoad()));
//
// marker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f)
// .icon(BitmapDescriptorFactory
// .defaultMarker(BitmapDescriptorFactory.HUE_BLUE))
// .position(latng)
// .title("我的位置:"+myAddressName));
// }
// else
LatLng latng = new LatLng(aLocation.getLatitude(),aLocation.getLongitude());
marker.setPosition(latng);
marker.setTitle("我的位置:"+this.aLocation.getCity()+this.aLocation.getDistrict()+this.aLocation.getRoad());
// marker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 1)
// .icons(giflist)
// .position(latng).title("我的位置:"+this.aLocation.getCity()+this.aLocation.getDistrict()+this.aLocation.getRoad()));
// marker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 1)
// .icon(BitmapDescriptorFactory.fromResource(R.drawable.point))
// .position(latng).title("我的位置:"+this.aLocation.getCity()+this.aLocation.getDistrict()+this.aLocation.getRoad()));
marker.showInfoWindow();
aMap.moveCamera(CameraUpdateFactory
.newCameraPosition(new CameraPosition( latng, 16f, 38.5f, 30000)));
float bearing = aMap.getCameraPosition().bearing;
aMap.setMyLocationRotateAngle(bearing);// 设置小蓝点旋转角度
}
deactivate();
}
示例9: onLocationChanged
import com.amap.api.location.AMapLocation; //导入方法依赖的package包/类
@Override
public void onLocationChanged(AMapLocation amapLocation) {
if (mDataSave == null) {
mDataSave = new LocationDataSave();
}
if (amapLocation != null) {
if (amapLocation.getErrorCode() == 0) {
// 定位成功回调信息,设置相关消息
amapLocation.getLocationType();// 获取当前定位结果来源,如网络定位结果,详见定位类型表
double lat = amapLocation.getLatitude();// 获取纬度
double lng = amapLocation.getLongitude();// 获取经度
amapLocation.getAccuracy();// 获取精度信息
SimpleDateFormat df = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
Date date = new Date(amapLocation.getTime());
df.format(date);// 定位时间
StringTool.DateToString1(new Date(amapLocation.getTime()));
String address = amapLocation.getAddress();// 地址,如果option中设置isNeedAddress为false,则没有此结果,网络定位结果中会有地址信息,GPS定位不返回地址信息。
amapLocation.getCountry();// 国家信息
amapLocation.getProvince();// 省信息
amapLocation.getCity();// 城市信息
amapLocation.getDistrict();// 城区信息
amapLocation.getStreet();// 街道信息
amapLocation.getStreetNum();// 街道门牌号信息
amapLocation.getCityCode();// 城市编码
amapLocation.getAdCode();// 地区编码
String mLocationAOI = amapLocation.getAoiName();// 获取当前定位点的AOI信息
if (!isFirst) {
mDataSave.setAddress(address);
mDataSave.setLat(lat);
mDataSave.setLng(lng);
mDataSave.setLocationAOI(mLocationAOI);
if (mLocationAOI != null && !mLocationAOI.equals("")) {
storeName.setText(mLocationAOI);
} else {
storeName.setText(amapLocation.getCity()
+ amapLocation.getDistrict()
+ amapLocation.getStreet()
+ amapLocation.getStreetNum());
}
addressName.setText(address);
getView().initLatLng(lat, lng);
isFirst = true;
}
} else {
// 显示错误信息ErrCode是错误码,errInfo是错误信息,详见错误码表。
Log.e("AmapError", "location Error, ErrCode:"
+ amapLocation.getErrorCode() + ", errInfo:"
+ amapLocation.getErrorInfo());
}
}
}