I have a requirement to display a custom Activity which contains a listview showing all the timeZones as per below format:
ZoneID (UTC <+/-> hh:mm)
These timezones should be sorted (similar to TimeZone settings shown in Windows) such that:
- All UTC negative timezones appear first
- All UTC+00:00 timezones appear next
- All timezones greater than UTC+00:00 appear last
I came across a lot of examples but they all are using JDK 1.8 (Android API level 26) with ZoneId
class. Few such examples are explained here and here.
I want some alternative to these examples, which I can use in Android API level 23 or JDK 1.7.
Expected Output:
America/Thule (UTC-03:00)
America/Argentina/La_Rioja (UTC-03:00)
America/Belem (UTC-03:00)
America/Jujuy (UTC-03:00)
America/Bahia (UTC-03:00)
America/Goose_Bay (UTC-03:00)
America/Argentina/San_Juan (UTC-03:00)
America/Argentina/ComodRivadavia (UTC-03:00)
America/Argentina/Tucuman (UTC-03:00)
America/Rosario (UTC-03:00)
SystemV/AST4ADT (UTC-03:00)
America/Argentina/Buenos_Aires (UTC-03:00)
America/St_Johns (UTC-02:30)
Canada/Newfoundland (UTC-02:30)
America/Miquelon (UTC-02:00)
Etc/GMT+2 (UTC-02:00)
America/Godthab (UTC-02:00)
America/Noronha (UTC-02:00)
Brazil/DeNoronha (UTC-02:00)
Atlantic/South_Georgia (UTC-02:00)
Etc/GMT+1 (UTC-01:00)
Atlantic/Cape_Verde (UTC-01:00)
Africa/Dakar (UTC+00:00)
Africa/Bissau (UTC+00:00)
WET (UTC+00:00)
Etc/Greenwich (UTC+00:00)
Africa/Timbuktu (UTC+00:00)
Africa/Monrovia (UTC+00:00)
Europe/Bratislava (UTC+01:00)
Arctic/Longyearbyen (UTC+01:00)
Europe/Vatican (UTC+01:00)
Europe/Monaco (UTC+01:00)
Africa/Harare (UTC+02:00)
Europe/Tallinn (UTC+02:00)