5.26学习记录

高德地图获取定位信息
private class MyAMapLocationListener implements AMapLocationListener {
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
EditText Location=(EditText)findViewById(R.id.editText4);
Location.setText(aMapLocation.getAddress());
if (aMapLocation != null) {
if (aMapLocation.getErrorCode() == 0) {
Log.e("位置:", aMapLocation.getAddress());
} else {
//定位失败时,可通过ErrCode(错误码)信息来确定失败的原因,errInfo是错误信息,详见错误码表。
Log.e("AmapError", "location Error, ErrCode:"
+ aMapLocation.getErrorCode() + ", errInfo:"
+ aMapLocation.getErrorInfo());
}
}
}
}
原文地址:https://www.cnblogs.com/blog-wangke/p/14865799.html