更新时间:2022-12-26 11:43:20
这是你的问题:
int latitude = (int) (location.getLatitude());
int longitude = (int) (location.getLongitude());
纬度和经度是 double
值,因为它们以度数表示位置.
Latitude and Longitude are double
-values, because they represent the location in degrees.
通过将它们转换为 int
,您将丢弃逗号后面的所有内容,这会产生很大的不同.请参阅十进制度 - Wiki"
By casting them to int
, you're discarding everything behind the comma, which makes a big difference. See "Decimal Degrees - Wiki"