Android Location.getLatitude()&;location.getLength不提供小数
因此,我正在制作一个应用程序,通过GPS计算您的位置(点1)和另一个指定位置(点2)之间的距离 我遇到的问题是函数Android Location.getLatitude()&;location.getLength不提供小数,android,gps,Android,Gps,因此,我正在制作一个应用程序,通过GPS计算您的位置(点1)和另一个指定位置(点2)之间的距离 我遇到的问题是函数location.getLatitude()和location.getLongitude()似乎没有输出任何小数 这是我的密码: Location locationA = new Location("point A"); locationA.setLatitude(52.44530); //Point 1 coords locatio
location.getLatitude()
和location.getLongitude()
似乎没有输出任何小数
这是我的密码:
Location locationA = new Location("point A");
locationA.setLatitude(52.44530); //Point 1 coords
locationA.setLongitude(19.02886);
Location locationB = new Location("point B");
locationB.setLatitude(location.getLatitude()); //Point 2 coords
locationB.setLongitude(location.getLongitude());
float distance = locationA.distanceTo(locationB);
textView.append("\n "+distance);
LocationA
工作,我使用location.setLatitude()
手动设置它(我也可以用同样的方法设置LocationB
),但是当我使用Android设备管理器
输入location.getLatitude()
将使用的手动GPS
位置时,它只输出例如52.00000