Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要从 myLocation 获得我的速度,它总是返回 0 ...我需要帮助
@Override public void onLocationChanged(Location location) { Log.e("location",String.valueOf(location.getSpeed())); }
简单getSpeed()方法仅在可用时返回速度,
getSpeed()
如果此位置没有速度,则返回 0.0。
如果您确定您有适当的速度可以显示并且必须返回某些东西,那么请考虑此代码,并尝试使您的代码与该代码相同。