Android Location getTime() 添加 1 天错误
我目前使用的是三星 Galaxy Tab P1000,但我遇到了一个问题,我不确定是否会在所有智能手机上发生。 同步GPS时,每次我获取location.getTime();它返回实际日期加上 1 天。我做错了什么还是这是一个错误?
代码如下:
@Override
public void onLocationChanged(Location location) {
setRealTime(location.getTime());
...
data = new Date();
data.setTime(getRealTime());
}
然后例如,今天是 15:31 01/16 它显示 15:31 01/17
问题仅出现在 Samsung Galaxy Tab P1000 中......
有什么想法吗?
I'm currently using a Samsung Galaxy Tab P1000, and I'm stuck in a problem that I don't know for sure if happens in all smartphones.
When synchronizing the GPS, everytime I get the location.getTime(); it returns the actual date plus 1 day. Am I doing something wrong or is this a bug?
Here is the code:
@Override
public void onLocationChanged(Location location) {
setRealTime(location.getTime());
...
data = new Date();
data.setTime(getRealTime());
}
And then for example, it today is 15:31 01/16 it shows 15:31 01/17
The Problem is exclusively in the Samsung Galaxy Tab P1000...
any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是三星固件中的闰年错误,已得到三星证实。请参阅 Android :Samsung Galaxy Tabs 和 Android 2.2 Devices Showing GPS date 1 Day Advance from 1st jan 2012
该答案显示了一些可以解决该问题的代码;简短版本是使用 NmeaListener 而不是 LocationListener。它可能会在 2 月 29 日自行修复......
This is a leap year bug in Samsung firmware, confirmed by Samsung. See Android : Samsung Galaxy Tabs and Android 2.2 Devices Showing GPS date 1 Day Advance from 1st jan 2012
That answer shows some code which works around it; short version is to use an NmeaListener instead of a LocationListener. And it may fix itself on Feb 29th...