/[zanavi_public1]/navit/navit/android/src/com/zoffcc/applications/zanavi/NavitAddressSearchCountrySelectActivity.java
ZANavi

Contents of /navit/navit/android/src/com/zoffcc/applications/zanavi/NavitAddressSearchCountrySelectActivity.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations) (download)
Fri Oct 28 21:19:04 2011 UTC (12 years, 5 months ago) by zoff99
File size: 12473 byte(s)
import files
1 /**
2 * ZANavi, Zoff Android Navigation system.
3 * Copyright (C) 2011 Zoff <zoff@zoff.cc>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 package com.zoffcc.applications.zanavi;
21
22 import android.app.Activity;
23 import android.app.ListActivity;
24 import android.content.Intent;
25 import android.os.Bundle;
26 import android.view.View;
27 import android.widget.ArrayAdapter;
28 import android.widget.ListView;
29
30 public class NavitAddressSearchCountrySelectActivity extends ListActivity
31 {
32 public static String[] CountryList = null;
33
34 public static String[][] CountryList_Human = { { "*D", "*DD", "*DEFAULT*" }, { "*A", "*AA", "*ALL*" }, { "AD", "AND", /* 020 */"Andorra" }, { "AE", "ARE", /* 784 */"United Arab Emirates" }, { "AF", "AFG", /* 004 */"Afghanistan" }, { "AG", "ATG", /* 028 */"Antigua and Barbuda" }, { "AI", "AIA", /* 660 */"Anguilla" }, { "AL", "ALB", /* 008 */"Albania" }, { "AM", "ARM", /* 051 */"Armenia" }, { "AN", "ANT", /* 530 */"Netherlands Antilles" }, { "AO", "AGO", /* 024 */"Angola" },
35 { "AQ", "ATA", /* 010 */"Antarctica" }, { "AR", "ARG", /* 032 */"Argentina" }, { "AS", "ASM", /* 016 */"American Samoa" }, { "AT", "AUT", /* 040 */"Austria" }, { "AU", "AUS", /* 036 */"Australia" }, { "AW", "ABW", /* 533 */"Aruba" }, { "AX", "ALA", /* 248 */"Aland Islands" }, { "AZ", "AZE", /* 031 */"Azerbaijan" }, { "BA", "BIH", /* 070 */"Bosnia and Herzegovina" }, { "BB", "BRB", /* 052 */"Barbados" }, { "BD", "BGD", /* 050 */"Bangladesh" }, { "BE", "BEL", /* 056 */"Belgium" },
36 { "BF", "BFA", /* 854 */"Burkina Faso" }, { "BG", "BGR", /* 100 */"Bulgaria" }, { "BH", "BHR", /* 048 */"Bahrain" }, { "BI", "BDI", /* 108 */"Burundi" }, { "BJ", "BEN", /* 204 */"Benin" }, { "BL", "BLM", /* 652 */"Saint Barthelemy" }, { "BM", "BMU", /* 060 */"Bermuda" }, { "BN", "BRN", /* 096 */"Brunei Darussalam" }, { "BO", "BOL", /* 068 */"Bolivia" }, { "BR", "BRA", /* 076 */"Brazil" }, { "BS", "BHS", /* 044 */"Bahamas" }, { "BT", "BTN", /* 064 */"Bhutan" },
37 { "BV", "BVT", /* 074 */"Bouvet Island" }, { "BW", "BWA", /* 072 */"Botswana" }, { "BY", "BLR", /* 112 */"Belarus" }, { "BZ", "BLZ", /* 084 */"Belize" }, { "CA", "CAN", /* 124 */"Canada" }, { "CC", "CCK", /* 166 */"Cocos (Keeling) Islands" }, { "CD", "COD", /* 180 */"Congo, Democratic Republic of the" }, { "CF", "CAF", /* 140 */"Central African Republic" }, { "CG", "COG", /* 178 */"Congo" }, { "CH", "CHE", /* 756 */"Switzerland" }, { "CI", "CIV", /* 384 */"Cote d'Ivoire" },
38 { "CK", "COK", /* 184 */"Cook Islands" }, { "CL", "CHL", /* 152 */"Chile" }, { "CM", "CMR", /* 120 */"Cameroon" }, { "CN", "CHN", /* 156 */"China" }, { "CO", "COL", /* 170 */"Colombia" }, { "CR", "CRI", /* 188 */"Costa Rica" }, { "CU", "CUB", /* 192 */"Cuba" }, { "CV", "CPV", /* 132 */"Cape Verde" }, { "CX", "CXR", /* 162 */"Christmas Island" }, { "CY", "CYP", /* 196 */"Cyprus" }, { "CZ", "CZE", /* 203 */"Czech Republic" }, { "DE", "DEU", /* 276 */"Germany" },
39 { "DJ", "DJI", /* 262 */"Djibouti" }, { "DK", "DNK", /* 208 */"Denmark" }, { "DM", "DMA", /* 212 */"Dominica" }, { "DO", "DOM", /* 214 */"Dominican Republic" }, { "DZ", "DZA", /* 012 */"Algeria" }, { "EC", "ECU", /* 218 */"Ecuador" }, { "EE", "EST", /* 233 */"Estonia" }, { "EG", "EGY", /* 818 */"Egypt" }, { "EH", "ESH", /* 732 */"Western Sahara" }, { "ER", "ERI", /* 232 */"Eritrea" }, { "ES", "ESP", /* 724 */"Spain" }, { "ET", "ETH", /* 231 */"Ethiopia" },
40 { "FI", "FIN", /* 246 */"Finland" }, { "FJ", "FJI", /* 242 */"Fiji" }, { "FK", "FLK", /* 238 */"Falkland Islands (Malvinas)" }, { "FM", "FSM", /* 583 */"Micronesia, Federated States of" }, { "FO", "FRO", /* 234 */"Faroe Islands" }, { "FR", "FRA", /* 250 */"France" }, { "GA", "GAB", /* 266 */"Gabon" }, { "GB", "GBR", /* 826 */"United Kingdom" }, { "GD", "GRD", /* 308 */"Grenada" }, { "GE", "GEO", /* 268 */"Georgia" }, { "GF", "GUF", /* 254 */"French Guiana" },
41 { "GG", "GGY", /* 831 */"Guernsey" }, { "GH", "GHA", /* 288 */"Ghana" }, { "GI", "GIB", /* 292 */"Gibraltar" }, { "GL", "GRL", /* 304 */"Greenland" }, { "GM", "GMB", /* 270 */"Gambia" }, { "GN", "GIN", /* 324 */"Guinea" }, { "GP", "GLP", /* 312 */"Guadeloupe" }, { "GQ", "GNQ", /* 226 */"Equatorial Guinea" }, { "GR", "GRC", /* 300 */"Greece" }, { "GS", "SGS", /* 239 */"South Georgia and the South Sandwich Islands" }, { "GT", "GTM", /* 320 */"Guatemala" },
42 { "GU", "GUM", /* 316 */"Guam" }, { "GW", "GNB", /* 624 */"Guinea-Bissau" }, { "GY", "GUY", /* 328 */"Guyana" }, { "HK", "HKG", /* 344 */"Hong Kong" }, { "HM", "HMD", /* 334 */"Heard Island and McDonald Islands" }, { "HN", "HND", /* 340 */"Honduras" }, { "HR", "HRV", /* 191 */"Croatia" }, { "HT", "HTI", /* 332 */"Haiti" }, { "HU", "HUN", /* 348 */"Hungary" }, { "ID", "IDN", /* 360 */"Indonesia" }, { "IE", "IRL", /* 372 */"Ireland" }, { "IL", "ISR", /* 376 */"Israel" },
43 { "IM", "IMN", /* 833 */"Isle of Man" }, { "IN", "IND", /* 356 */"India" }, { "IO", "IOT", /* 086 */"British Indian Ocean Territory" }, { "IQ", "IRQ", /* 368 */"Iraq" }, { "IR", "IRN", /* 364 */"Iran, Islamic Republic of" }, { "IS", "ISL", /* 352 */"Iceland" }, { "IT", "ITA", /* 380 */"Italy" }, { "JE", "JEY", /* 832 */"Jersey" }, { "JM", "JAM", /* 388 */"Jamaica" }, { "JO", "JOR", /* 400 */"Jordan" }, { "JP", "JPN", /* 392 */"Japan" }, { "KE", "KEN", /* 404 */"Kenya" },
44 { "KG", "KGZ", /* 417 */"Kyrgyzstan" }, { "KH", "KHM", /* 116 */"Cambodia" }, { "KI", "KIR", /* 296 */"Kiribati" }, { "KM", "COM", /* 174 */"Comoros" }, { "KN", "KNA", /* 659 */"Saint Kitts and Nevis" }, { "KP", "PRK", /* 408 */"Korea, Democratic People's Republic of" }, { "KR", "KOR", /* 410 */"Korea, Republic of" }, { "KW", "KWT", /* 414 */"Kuwait" }, { "KY", "CYM", /* 136 */"Cayman Islands" }, { "KZ", "KAZ", /* 398 */"Kazakhstan" },
45 { "LA", "LAO", /* 418 */"Lao People's Democratic Republic" }, { "LB", "LBN", /* 422 */"Lebanon" }, { "LC", "LCA", /* 662 */"Saint Lucia" }, { "LI", "LIE", /* 438 */"Liechtenstein" }, { "LK", "LKA", /* 144 */"Sri Lanka" }, { "LR", "LBR", /* 430 */"Liberia" }, { "LS", "LSO", /* 426 */"Lesotho" }, { "LT", "LTU", /* 440 */"Lithuania" }, { "LU", "LUX", /* 442 */"Luxembourg" }, { "LV", "LVA", /* 428 */"Latvia" }, { "LY", "LBY", /* 434 */"Libyan Arab Jamahiriya" },
46 { "MA", "MAR", /* 504 */"Morocco" }, { "MC", "MCO", /* 492 */"Monaco" }, { "MD", "MDA", /* 498 */"Moldova, Republic of" }, { "ME", "MNE", /* 499 */"Montenegro" }, { "MF", "MAF", /* 663 */"Saint Martin (French part)" }, { "MG", "MDG", /* 450 */"Madagascar" }, { "MH", "MHL", /* 584 */"Marshall Islands" }, { "MK", "MKD", /* 807 */"Macedonia, the former Yugoslav Republic of" }, { "ML", "MLI", /* 466 */"Mali" }, { "MM", "MMR", /* 104 */"Myanmar" }, { "MN", "MNG", /* 496 */"Mongolia" },
47 { "MO", "MAC", /* 446 */"Macao" }, { "MP", "MNP", /* 580 */"Northern Mariana Islands" }, { "MQ", "MTQ", /* 474 */"Martinique" }, { "MR", "MRT", /* 478 */"Mauritania" }, { "MS", "MSR", /* 500 */"Montserrat" }, { "MT", "MLT", /* 470 */"Malta" }, { "MU", "MUS", /* 480 */"Mauritius" }, { "MV", "MDV", /* 462 */"Maldives" }, { "MW", "MWI", /* 454 */"Malawi" }, { "MX", "MEX", /* 484 */"Mexico" }, { "MY", "MYS", /* 458 */"Malaysia" }, { "MZ", "MOZ", /* 508 */"Mozambique" },
48 { "NA", "NAM", /* 516 */"Namibia" }, { "NC", "NCL", /* 540 */"New Caledonia" }, { "NE", "NER", /* 562 */"Niger" }, { "NF", "NFK", /* 574 */"Norfolk Island" }, { "NG", "NGA", /* 566 */"Nigeria" }, { "NI", "NIC", /* 558 */"Nicaragua" }, { "NL", "NLD", /* 528 */"Netherlands" }, { "NO", "NOR", /* 578 */"Norway" }, { "NP", "NPL", /* 524 */"Nepal" }, { "NR", "NRU", /* 520 */"Nauru" }, { "NU", "NIU", /* 570 */"Niue" }, { "NZ", "NZL", /* 554 */"New Zealand" },
49 { "OM", "OMN", /* 512 */"Oman" }, { "PA", "PAN", /* 591 */"Panama" }, { "PE", "PER", /* 604 */"Peru" }, { "PF", "PYF", /* 258 */"French Polynesia" }, { "PG", "PNG", /* 598 */"Papua New Guinea" }, { "PH", "PHL", /* 608 */"Philippines" }, { "PK", "PAK", /* 586 */"Pakistan" }, { "PL", "POL", /* 616 */"Poland" }, { "PM", "SPM", /* 666 */"Saint Pierre and Miquelon" }, { "PN", "PCN", /* 612 */"Pitcairn" }, { "PR", "PRI", /* 630 */"Puerto Rico" },
50 { "PS", "PSE", /* 275 */"Palestinian Territory, Occupied" }, { "PT", "PRT", /* 620 */"Portugal" }, { "PW", "PLW", /* 585 */"Palau" }, { "PY", "PRY", /* 600 */"Paraguay" }, { "QA", "QAT", /* 634 */"Qatar" }, { "RE", "REU", /* 638 */"Reunion" }, { "RO", "ROU", /* 642 */"Romania" }, { "RS", "SRB", /* 688 */"Serbia" }, { "RU", "RUS", /* 643 */"Russian Federation" }, { "RW", "RWA", /* 646 */"Rwanda" }, { "SA", "SAU", /* 682 */"Saudi Arabia" }, { "SB", "SLB", /* 090 */"Solomon Islands" },
51 { "SC", "SYC", /* 690 */"Seychelles" }, { "SD", "SDN", /* 736 */"Sudan" }, { "SE", "SWE", /* 752 */"Sweden" }, { "SG", "SGP", /* 702 */"Singapore" }, { "SH", "SHN", /* 654 */"Saint Helena" }, { "SI", "SVN", /* 705 */"Slovenia" }, { "SJ", "SJM", /* 744 */"Svalbard and Jan Mayen" }, { "SK", "SVK", /* 703 */"Slovakia" }, { "SL", "SLE", /* 694 */"Sierra Leone" }, { "SM", "SMR", /* 674 */"San Marino" }, { "SN", "SEN", /* 686 */"Senegal" }, { "SO", "SOM", /* 706 */"Somalia" },
52 { "SR", "SUR", /* 740 */"Suriname" }, { "ST", "STP", /* 678 */"Sao Tome and Principe" }, { "SV", "SLV", /* 222 */"El Salvador" }, { "SY", "SYR", /* 760 */"Syrian Arab Republic" }, { "SZ", "SWZ", /* 748 */"Swaziland" }, { "TC", "TCA", /* 796 */"Turks and Caicos Islands" }, { "TD", "TCD", /* 148 */"Chad" }, { "TF", "ATF", /* 260 */"French Southern Territories" }, { "TG", "TGO", /* 768 */"Togo" }, { "TH", "THA", /* 764 */"Thailand" }, { "TJ", "TJK", /* 762 */"Tajikistan" },
53 { "TK", "TKL", /* 772 */"Tokelau" }, { "TL", "TLS", /* 626 */"Timor-Leste" }, { "TM", "TKM", /* 795 */"Turkmenistan" }, { "TN", "TUN", /* 788 */"Tunisia" }, { "TO", "TON", /* 776 */"Tonga" }, { "TR", "TUR", /* 792 */"Turkey" }, { "TT", "TTO", /* 780 */"Trinidad and Tobago" }, { "TV", "TUV", /* 798 */"Tuvalu" }, { "TW", "TWN", /* 158 */"Taiwan, Province of China" }, { "TZ", "TZA", /* 834 */"Tanzania, United Republic of" }, { "UA", "UKR", /* 804 */"Ukraine" },
54 { "UG", "UGA", /* 800 */"Uganda" }, { "UM", "UMI", /* 581 */"United States Minor Outlying Islands" }, { "US", "USA", /* 840 */"United States" }, { "UY", "URY", /* 858 */"Uruguay" }, { "UZ", "UZB", /* 860 */"Uzbekistan" }, { "VA", "VAT", /* 336 */"Holy See (Vatican City State)" }, { "VC", "VCT", /* 670 */"Saint Vincent and the Grenadines" }, { "VE", "VEN", /* 862 */"Venezuela" }, { "VG", "VGB", /* 092 */"Virgin Islands, British" }, { "VI", "VIR", /* 850 */"Virgin Islands, U.S." },
55 { "VN", "VNM", /* 704 */"Viet Nam" }, { "VU", "VUT", /* 548 */"Vanuatu" }, { "WF", "WLF", /* 876 */"Wallis and Futuna" }, { "WS", "WSM", /* 882 */"Samoa" }, { "YE", "YEM", /* 887 */"Yemen" }, { "YT", "MYT", /* 175 */"Mayotte" }, { "ZA", "ZAF", /* 710 */"South Africa" }, { "ZM", "ZMB", /* 894 */"Zambia" }, { "ZW", "ZWE", /* 716 */"Zimbabwe" } };
56
57 private int selected_id = -1;
58
59 @Override
60 public void onCreate(Bundle savedInstanceState)
61 {
62 super.onCreate(savedInstanceState);
63
64 int l = CountryList_Human.length;
65 int i = 0;
66 CountryList = new String[l];
67 for (i = 0; i < l; i++)
68 {
69 CountryList[i] = CountryList_Human[i][2];
70 }
71
72 ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, NavitAddressSearchCountrySelectActivity.CountryList);
73 setListAdapter(adapter);
74 this.getListView().setFastScrollEnabled(true);
75 }
76
77 @Override
78 protected void onListItemClick(ListView l, View v, int position, long id)
79 {
80 super.onListItemClick(l, v, position, id);
81 // Get the item that was clicked
82 this.selected_id = position;
83 // close this activity
84 executeDone();
85 }
86
87 private void executeDone()
88 {
89 Intent resultIntent = new Intent();
90 resultIntent.putExtra("selected_id", String.valueOf(this.selected_id));
91 setResult(Activity.RESULT_OK, resultIntent);
92 finish();
93 }
94 }

   
Visit the ZANavi Wiki