1 /*
2  * Copyright (C) 2007 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.example.android.apis.view;
18 
19 import com.example.android.apis.R;
20 
21 import android.app.Activity;
22 import android.widget.ArrayAdapter;
23 import android.widget.MultiAutoCompleteTextView;
24 import android.os.Bundle;
25 
26 public class AutoComplete6 extends Activity {
27 
28     @Override
onCreate(Bundle savedInstanceState)29     protected void onCreate(Bundle savedInstanceState) {
30         super.onCreate(savedInstanceState);
31         setContentView(R.layout.autocomplete_6);
32 
33         ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
34                 android.R.layout.simple_dropdown_item_1line, COUNTRIES);
35         MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) findViewById(R.id.edit);
36         textView.setAdapter(adapter);
37         textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
38     }
39 
40     static final String[] COUNTRIES = new String[] {
41     "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra",
42     "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina",
43     "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan",
44     "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium",
45     "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia",
46     "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory",
47     "British Virgin Islands", "Brunei", "Bulgaria", "Burkina Faso", "Burundi",
48     "Cote d'Ivoire", "Cambodia", "Cameroon", "Canada", "Cape Verde",
49     "Cayman Islands", "Central African Republic", "Chad", "Chile", "China",
50     "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo",
51     "Cook Islands", "Costa Rica", "Croatia", "Cuba", "Cyprus", "Czechia",
52     "Democratic Republic of the Congo", "Denmark", "Djibouti", "Dominica", "Dominican Republic",
53     "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea",
54     "Estonia", "Ethiopia", "Faeroe Islands", "Falkland Islands", "Fiji", "Finland",
55     "Former Yugoslav Republic of Macedonia", "France", "French Guiana", "French Polynesia",
56     "French Southern Territories", "Gabon", "Georgia", "Germany", "Ghana", "Gibraltar",
57     "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau",
58     "Guyana", "Haiti", "Heard Island and McDonald Islands", "Honduras", "Hong Kong", "Hungary",
59     "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica",
60     "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Kuwait", "Kyrgyzstan", "Laos",
61     "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg",
62     "Macau", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands",
63     "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia", "Moldova",
64     "Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia",
65     "Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand",
66     "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "North Korea", "Northern Marianas",
67     "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru",
68     "Philippines", "Pitcairn Islands", "Poland", "Portugal", "Puerto Rico", "Qatar",
69     "Reunion", "Romania", "Russia", "Rwanda", "Sqo Tome and Principe", "Saint Helena",
70     "Saint Kitts and Nevis", "Saint Lucia", "Saint Pierre and Miquelon",
71     "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Saudi Arabia", "Senegal",
72     "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands",
73     "Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "South Korea",
74     "Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard and Jan Mayen", "Swaziland", "Sweden",
75     "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "The Bahamas",
76     "The Gambia", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey",
77     "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Virgin Islands", "Uganda",
78     "Ukraine", "United Arab Emirates", "United Kingdom",
79     "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan",
80     "Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Wallis and Futuna", "Western Sahara",
81     "Yemen", "Yugoslavia", "Zambia", "Zimbabwe"
82     };
83 }
84