Home | History | Annotate | Download | only in view
      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.Spinner;
     23 import android.widget.ArrayAdapter;
     24 import android.widget.AutoCompleteTextView;
     25 import android.os.Bundle;
     26 import android.view.View;
     27 
     28 
     29 public class AutoComplete1 extends Activity {
     30 
     31     @Override
     32     protected void onCreate(Bundle savedInstanceState) {
     33         super.onCreate(savedInstanceState);
     34         setContentView(R.layout.autocomplete_1);
     35 
     36         ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
     37                 android.R.layout.simple_dropdown_item_1line, COUNTRIES);
     38         AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.edit);
     39         textView.setAdapter(adapter);
     40     }
     41 
     42     static final String[] COUNTRIES = new String[] {
     43 	"Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra",
     44 	"Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina",
     45 	"Armenia", "Aruba", "Australia", "Austria", "Azerbaijan",
     46 	"Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium",
     47 	"Belize", "Benin", "Bermuda", "Bhutan", "Bolivia",
     48 	"Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory",
     49 	"British Virgin Islands", "Brunei", "Bulgaria", "Burkina Faso", "Burundi",
     50 	"Cote d'Ivoire", "Cambodia", "Cameroon", "Canada", "Cape Verde",
     51 	"Cayman Islands", "Central African Republic", "Chad", "Chile", "China",
     52 	"Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo",
     53 	"Cook Islands", "Costa Rica", "Croatia", "Cuba", "Cyprus", "Czech Republic",
     54 	"Democratic Republic of the Congo", "Denmark", "Djibouti", "Dominica", "Dominican Republic",
     55 	"East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea",
     56 	"Estonia", "Ethiopia", "Faeroe Islands", "Falkland Islands", "Fiji", "Finland",
     57 	"Former Yugoslav Republic of Macedonia", "France", "French Guiana", "French Polynesia",
     58 	"French Southern Territories", "Gabon", "Georgia", "Germany", "Ghana", "Gibraltar",
     59 	"Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau",
     60 	"Guyana", "Haiti", "Heard Island and McDonald Islands", "Honduras", "Hong Kong", "Hungary",
     61 	"Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica",
     62 	"Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Kuwait", "Kyrgyzstan", "Laos",
     63 	"Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg",
     64 	"Macau", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands",
     65 	"Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia", "Moldova",
     66 	"Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia",
     67 	"Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand",
     68 	"Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "North Korea", "Northern Marianas",
     69 	"Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru",
     70 	"Philippines", "Pitcairn Islands", "Poland", "Portugal", "Puerto Rico", "Qatar",
     71 	"Reunion", "Romania", "Russia", "Rwanda", "Sqo Tome and Principe", "Saint Helena",
     72 	"Saint Kitts and Nevis", "Saint Lucia", "Saint Pierre and Miquelon",
     73 	"Saint Vincent and the Grenadines", "Samoa", "San Marino", "Saudi Arabia", "Senegal",
     74 	"Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands",
     75 	"Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "South Korea",
     76 	"Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard and Jan Mayen", "Swaziland", "Sweden",
     77 	"Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "The Bahamas",
     78 	"The Gambia", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey",
     79 	"Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Virgin Islands", "Uganda",
     80 	"Ukraine", "United Arab Emirates", "United Kingdom",
     81 	"United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan",
     82 	"Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Wallis and Futuna", "Western Sahara",
     83 	"Yemen", "Yugoslavia", "Zambia", "Zimbabwe"
     84     };
     85 }
     86