为什么会有这篇文章
因为前一篇/title71/article/details/115064924
这个方法突然失效了,没办法,得看看,高德有没有提供,刚好,可以直接转换,挺方便
public AMapLocation fromGpsToAmap() {Location location = LocationUtils.getInstance(uploadService.this).showLocation();AMapLocation aMapLocation = new AMapLocation(location);CoordinateConverter converter = new CoordinateConverter(mContext);converter.from(CoordinateConverter.CoordType.GPS);try {converter.coord(new DPoint(location.getLatitude(), location.getLongitude()));DPoint desLatLng = converter.convert();aMapLocation.setLatitude(desLatLng.getLatitude());aMapLocation.setLongitude(desLatLng.getLongitude());} catch (Exception e) {e.printStackTrace();}return aMapLocation;}
调用
address = fromGpsToAmap(location).getLongitude()+","+fromGpsToAmap(location).getLatitude();