我如何获得可用的时区(android:settings) [英] How I can get available timezones (android:settings)

查看:741
本文介绍了我如何获得可用的时区(android:settings)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取 TimeZones ,该设置可以在以下设置中看到:日期和时间->

I want to get TimeZones, that I can see in settings: Date and Time -->

是的,我知道,在java/android中可以通过TimeZone.getAvailableIDs()获取所有时区,但是我只想获取存在于该时间段的时区

Yes, I know, that in java/android can get all timezones by TimeZone.getAvailableIDs(), but I want get only timezones, that exists on

.

推荐答案

是的,我已经尝试选择一个偏移量-一个时区.但是在这种情况下,会得到另一个错误.我以编程方式将事件添加到Google日历(解析ics-file)时使用了该时区.在某些时区,我遇到了问题.例如,我添加时区+6 GMT的事件.

Yes, I already try to select one offset - one timezone. But in this case get another error. I used this timezone on programmatically add event to google calendar (parse ics-file). With some timezone I have issue. For example, I add event with timezone +6 GMT.

getAvailableIDs()在第一个时区返回此偏移量(我不太清楚,但是时区是".../Vostok").如果我尝试使用该时区添加事件,那么我在Google日历android应用程序中打开了此添加事件,然后看到该时区​​不是正常的美国/纽约"或欧洲/莫斯科",而是"+ 6 GMT".

getAvailableIDs() return with this offset some first timezone (I do not exactly remember, but timezone was ".../Vostok"). If I try add event with this timezone, then I opened this added event in Google Calendar android application and see, that timezone set not as normal "America/New York" or "Europe/Moscow", but simply "+ 6 GMT".

因此,我开始查看标准"时区列表.现在,我使用了另一种方式.我在Google日历中进行搜索,发现它们未获得时区带有一些proc的运行时,但只需在静态数组中设置一些时区ID.现在,我也使用了此列表.我不知道,这个清单是如何从android版本更改的.但是在4.x和2.x上工作正常

So I began to look list "standart" timezones. Now I used some another way. I search in google calendar source and find that they do not get timezone in runtime with some proc, but simply set some timezone ids in static array. Now I also used this list. I do not know, how this list changed from android version. But worked correct on 4.x and 2.x

这篇关于我如何获得可用的时区(android:settings)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆