title: Some items not filtering from ListView using getFilter
body: <p>I have an activity with a ListView which is to be filtered by a Spinner containing country names. On selecting some country names, the ListView is filtered but on some names it doesn't show anything at all.</p>
  
  <p>Code:</p>
  
  <pre><code>public class Destination extends Activity {
  
  ArrayAdapter&lt;String&gt; aa1,aa2;
  
  /*listview*/ final String[] dest = {"Cordova, Alaska","Valdez, Alaska","Durres, Albania","Vlore, Albania","Algiers, Algeria","Annaba, Algeria","Berjaia, Algeria","Oran, Algeria","Skikda, Algeria","Lobito, Angola","Luanda, Angola","St. Johns, Antigua","Blanka, Argentina","Bahia, Argentina","Buenos Aires, Argentina","Cordoba, Argentina","Mendoza, Argentina","Rosario, Argentina","San Pedro, Argentina","Ushuaia, Argentina","Oranjestad, Aruba","Kabul, Afghanisthan","Hairatan, Afghanisthan","Torghundi, Afghanisthan","Adelaide, Australia","Bellbay, Australia","Brisbane, Australia","Broome, Australia","Burnie, Australia","Dampier, Australia","Darwin, Australia","Fremantle, Australia","Geraldton, Australia","Gladstone, Australia","Hobart, Australia","Melbourne, Australia","Port Hedland, Australia","Sydney, Australia","Townsville, Australia","Vienna, Austria","Nassau, Bahamas","Manama, Bahrain","Umm Said, Bahrain","Chittagong, Bangladesh","Mongla, Bangladesh","Bridgetown, Barbados","Belize, Belize","Cotonou, Benin","Port Novo, Benin","Altamira, Brazil","Belem, Brazil","Behia, Brazil","Degio Suarez, Brazil","Fortaleza, Brazil","Itajai, Brazil","Macapa, Brazil","Manaus, Brazil","Paranagua, Brazil","Portoalegre, Brazil","Recife, Brazil","Rio Grande, Brazil","Rio Grande Do Sul, Brazil","Rio De Janeiro, Brazil","Salvador, Brazil","Sao Francisco Do Sul, Brazil","Santos, Brazil","Suape, Brazil","Vitoria, Brazil","Brunei, Brunei","Kuala Belait, Brunei","Muara, Brunei","Antwerp, Belgium","Brussels, Belgium","Burgas, Bulgaria","Sofia, Bulgaria","Varna, Bulgaria","Rijeka, Croatia","Kampongsom, Cambodia","Phnom Penh, Cambodia","Douala, Cameroon","Halifax, Canada","Montreal, Canada","Prince Rupert, Canada","Toronto, Canada","Vancouver, Canada","Las Palmas, Canary Islands","Santa Cruz De Tenerife, Canary Islands","Tenerife, Canary Islands","Truk, Caroline","Ponape, Caroline","Antofagasta, Chile","Arica, Chile","Chanaral, Chile","Iquique, Chile","Lirquen, Chile","Punta Arenas, Chile","San Antonio, Chile","Santiago, Chile","Talcahuano, Chile","Valparaiso, Chile","Belhai, China","Dong Guan, China","Duo, China","Dailian, China","Fancheng, China","Foshan, China","Fuzhou, China","Guangzhou, China","Haikuo, China","Hangzhou, China","Hong Kong, China","Huangpu, China","Hsingkang, China","Jianmen, China","Lianyungang, China","Luda, China","Macou, China","Nanjing, China","Nantung, China","Ningbo, China","Qingdao, China","Quanzhou, China","Quinghuang, China","Shanghai, China","Shantou, China","Shekou, China","Shenzhen, China","Shaoxing, China","Suzhou, China","Shiqi, China","Tianjin, China","Wuxi, China","Wuzhou, China","Weihai, China","Wuhu, China","Wenzhou, China","Wu Han, China","Xiamen, China","Yangzhou, China","Yantai, China","Zhanjiang, China","Zhaoqing, China","Zhuhai, China","Zhangjiagang, China","Barranquilla, Columbia","Buenaventura, Columbia","Cartagena, Columbia","Santa Marta, Columbia","Moroni, Comoros Islands","Mutsamudu, Comoros Islands","Pointe Noire, Congo","Costa Rica, Congo","Puerto Caldera, Congo","Puerto Limon, Congo","Puntarenas, Congo","San Jose, Congo","Havana, Cuba","Manzanillo, Cuba","Matanzas, Cuba","Famagusta, Cyprus","Larnaca, Cyprus","Limassol, Cyprus","Prague, Czech Republic","Aarhus, Denmark","Copenhagen, Denmark","Esbjerg, Denmark","Sonderburg, Denmark","Djibouti, Djibouti","Rio Haina, Dominican Republic","Santa Domingo, Dominican Republic","Roseau, Dominica","Tallinn, Estonia","Esmeraldas, Ecuador","Guayaquil, Ecuador","Manta, Ecuador","Adabiya, Egypt","Alexandria, Egypt","Damietta, Egypt","Port Suez, Egypt","Port Said, Egypt","Acajutla, El Salvador","Assab, Ethiopia","Massawa, Ethiopia","Fiji, Fiji","Lauttoka, Fiji","Suva, Fiji","Helsinki, Finland","Kotka, Finland","Turku, Finland","Fos, France","Le Havre, France","Lyon, France","Marseilles, France","Nantes, France","Paris, France","Piraeus, Greece","Salonica, Greece","Kavalla, Greece","Patrai, Greece","Pirarievs, Greece","Thessaloniki, Greece","Volos, Greece","Libreville, Gabon","Port Gentil, Gabon","Banjul, Gambia","Bremen, Germany","Bremerhaven, Germany","Hamburg, Germany","Ludwigsburg, Germany","Munich, Germany","Rostok, Germany","Stuttgart, Germany","Sekondi, Ghana","Takoradi, Ghana","Tema, Ghana","Tawa, Gilbert","Georgetown, Grand Cayman","St. George's, Grenada","Puerto Quetzal, Guatemala","Santo Tomas De, Guatemala","De Castilla, Guatemala","Guam, Guam","Bissau, Guinea","Conakry, Guinea","Degrad Des Cannies, Guyana","Georgetown, Guyana","New Amsterdam, Guyana","Port-Au-Prince, Haiti","Honolulu, Hawaii","Puerto Cortes, Honduras","San Pedro Sula, Honduras","San Lorenzo, Honduras","Budapest, Hungary","Reykjavik, Iceland","Belfast, Ireland","Cork, Ireland","Dublin, Ireland","Wexford, Ireland","Ancona, Italy","Aprilia, Italy","Bari, Italy","Bologna, Italy","Catania, Italy","Cassibile, Italy","Florence, Italy","Genova, Italy","La Spezia, Italy","Latina, Italy","Leghorn, Italy","Livorno, Italy","Messina, Italy","Milan, Italy","Modena, Italy","Monfalcone, Italy","Naples, Italy","Palermo, Italy","Pisa, Italy","Ravenna, Italy","Regio, Italy","Rome, Italy","Salerno, Italy","Taranto, Italy","Trieste, Italy","Turin, Italy","Venice, Italy","Verona, Italy","Bandar Abbas, Iran","Bandar Khomeini, Iran","Kish Island, Iran","Baghdad, Iraq","Umm Qasr, Iraq","Ashdod, Israel","Haifa, Israel","Balikpapan, Indonesia","Balikpapan, Indonesia","Banjarmasin, Indonesia","Batu Ampar, Indonesia","Belawan, Indonesia","Bengkulu, Indonesia","Cirebon, Indonesia","Dili, Indonesia","Duman, Indonesia","Jakarta, Indonesia","Jambi, Indonesia","Kabil, Indonesia","Kupang, Indonesia","Medan, Indonesia","Muka Kuning, Indonesia","Padang, Indonesia","Palembang, Indonesia","Panjang, Indonesia","Pekan Baru, Indonesia","Perawang, Indonesia","Plaju, Indonesia","Pontianak, Indonesia","Samarinda, Indonesia","Sampit, Indonesia","Sekupang, Indonesia","Semarang, Indonesia","Surabaya, Indonesia","Tanjung Uncang, Indonesia","Ujung Padang, Indonesia","Abidjan, Ivory Coast","Kingston, Jamaica","Aqaba, Jordan","Chiba, Japan","Hachinohe, Japan","Hakata, Japan","Hiroshima, Japan","Hitachi, Japan","Imabari, Japan","Iwaki, Japan","Kagoshima, Japan","Kobe, Japan","Mizushima, Japan","Moji, Japan","Nagoya, Japan","Naha, Japan","Niigata, Japan","Okinawa, Japan","Osaka, Japan","Sakai, Japan","Sakaiminato, Japan","Senboku, Japan","Sendai, Japan","Shibushi, Japan","Shikou, Japan","Shimizu, Japan","Tokyo, Japan","Tomakomai, Japan","Toyama, Japan","Yokkaichi, Japan","Yokohama, Japan","Mombasa, Kenya","Pusan, Korea","Incheon, Korea","Chongjin, Korea","Nampo, Korea","Pyongyang, Korea","Kuwait, Kuwait","Riga, Latvia","Benghazi, Libya","Misratah, Libya","Tripoli, Libya","Monrovia, Liberia","Beirut, Lebanon","Macau, Macau","Bintulu, Malayasia","Joharbahru, Malayasia","Kota Kinabalu, Malayasia","Kuantan, Malayasia","Kuching, Malayasia","Labuan, Malayasia","Lahad Datu, Malayasia","Miri, Malayasia","Pasir Gudang, Malayasia","Penang, Malayasia","Port Kelang, Malayasia","Sandakan, Malayasia","Sibu, Malayasia","Tanjong Mani, Malayasia","Tawau, Malayasia","Diego Suarez, Malagasy","Mayotte, Malagasy","Nose Be, Malagasy","Nouadhibou, Mauritania","Nouakchott, Mauritania","St.Louis, Mauritania","Agadir, Morocco","Casablanca, Morocco","Ceuta, Morocco","Melilla, Morocco","Beira, Mozambique","Maputo, Mozambique","Nacala, Mozambique","Diego Suarez, Madagascar","Majunga, Madagascar","Nosy Be, Madagascar","Tamatave, Madagascar","Toamasine, Madagascar","Toliary, Madagascar","Sittive, Myanmar","Yangon, Myanmar","Malta, Malta","Valletta, Malta","Port De-France, Martinique","Malawi, Malawi","Port Louis, Mauritius","Acapulco, Mexico","Altamira, Mexico","Ensenada, Mexico","Guadalajara, Mexico","Lazaro Cardenas, Mexico","Manzanillo, Mexico","Mexico City, Mexico","Salina Cruz, Mexico","Tampico, Mexico","Vera Cruz, Mexico","Male, Maldives","Plymouth, Monserrat","Majuro, Marshall","Phonpei, Marshall","Ebeye, Micronesia","Koror, Micronesia","Saipan, Mariana","Luderitz, Namibia","Walvis Bay, Namibia","Santo, New Herbrides","Vila, New Herbrides","Corinto, Nicaragua","Curacao, Netherlands Antilles","Willemstad, Netherlands Antilles","Amsterdam, Netherlands","Rotterdam, Netherlands","Flushing, Netherlands","Bergen, Norway","Oslo, Norway","Stavanger, Norway","Apapa, Nigeria","Lagos, Nigeria","Port Harcourt, Nigeria","Tincan Island, Nigeria","Auckland, New Zealand","Bluff, New Zealand","Cambridge, New Zealand","Christchurch, New Zealand","Dunedin, New Zealand","Invercargill, New Zealand","Lyttelton, New Zealand","Napier, New Zealand","Nelson, New Zealand","New Plymouth, New Zealand","Port Chalmers, New Zealand","Port Pegasus, New Zealand","Tauranga, New Zealand","Timaru, New Zealand","Wellington, New Zealand","Noumea, New Caledonia","Muscat, Oman","Salalah, Oman","Balboa, Panama","Colon, Panama","Cristobal, Panama","Gatun, Panama","Panama City, Panama","Callou, Peru","Ponce, Puerto Rico","San Juan, Puerto Rico","Bydgoszcz, Poland","Bytom, Poland","Gdansk, Poland","Gdynia, Poland","Katowice, Poland","Krakow, Poland","Lodz, Poland","Poznan, Poland","Warsaw, Poland","Leixoes, Portugal","Lisbon, Portugal","Karachi, Pakistan","Calbayog, Philippines","Cebu, Philippines","Davou, Philippines","General Santos, Philippines","Lacena, Philippines","Lloilo, Philippines","Manila, Philippines","Zamboanga, Philippines","Alotau, Papua New Guinea","Kavieng, Papua New Guinea","Kimbe, Papua New Guinea","Lae, Papua New Guinea","Madang, Papua New Guinea","Oro Bay, Papua New Guinea","Port Moresby, Papua New Guinea","Rabaul, Papua New Guinea","Doha, Qatar","Constanza, Romania","Moscow, Russia","Nakhodka, Russia","Rostov, Russia","St. Petersburg, Russia","Vladivostok, Russia","Pointe Des Galets, Reunion Islands","Reunion, Reunion Islands","Singapore, Singapore","Honiara, Solomon Islands","Noro, Solomon Islands","Dakar, Senegal","Freetown, Sierra Leone","Mahe, Seychelles","Berbera, Somalia","Kismaya, Somalia","Mogadishu, Somalia","Port Sudan, Sudan","Paramabiro, Surinam","Aberdeen, Scotland","Glasgow, Scotland","Grangemouth, Scotland","Albacete, Spain","Algeciras, Spain","Alicante, Spain","Barcelona, Spain","Bilbao, Spain","Ceuta, Spain","Granada, Spain","Madrid, Spain","Malaga, Spain","Palma De Mallorca, Spain","Pasajes, Spain","Toledo, Spain","Valencia, Spain","Vigo, Spain","Zaragoza, Spain","Gothenburg, Sweden","Helsingborg, Sweden","Malmo, Sweden","Stockholm, Sweden","Basel, Switzerland","Geneva, Switzerland","Zurich, Switzerland","Lattakia, Syria","Al Jubail, Saudi Arabia","Dammam, Saudi Arabia","Jeddah, Saudi Arabia","Riyadh, Saudi Arabia","Colombo, Sri Lanka","Cape Town, South Africa","Durban, South Africa","East London, South Africa","Johannesburg, South Africa","Port Elizabeth, South Africa","Pretoria, South Africa","Richards Bay, South Africa","Basse Terre, St. Kitts","Philipsburg, St. Maarten","Kingstown, St. Vincent","Point Islas, Trinidad","Port Of Spain, Trinidad","Bizerte, Tunisia","Gabes, Tunisia","Sfax, Tunisia","Rades, Tunisia","Tunis, Tunisia","Antalya, Turkey","Derince, Turkey","Iskenderun, Turkey","Istanbul, Turkey","Izmir, Turkey","Mersin, Turkey","Trabzon, Turkey","Kaohsiung, Taiwan","Keelung, Taiwan","Taichung, Taiwan","Taipei, Taiwan","Bangkok, Thailand","Laem Chabong, Thailand","Songkhla, Thailand","Dar Es Salaam, Tanzania","Tanga, Tanzania","Zanzibar, Tanzania","Lome, Togo","Funafuti, Tuvalu","Nukualofa, Tonga","Vavau, Tonga","Papeete, Tahiti","Baltimore, USA North-East","Boston, USA North-East","Camden, USA North-East","New York, USA North-East","Newark, USA North-East","North Bergen, USA North-East","Philadelphia, USA North-East","Aberdeen, USA North-West","Cape Mendocino, USA North-West","Long View, USA North-West","Portland, USA North-West","Seattle, USA North-West","Tacoma, USA North-West","Chicago, USA Mid-West","Cincinnati, USA Mid-West","Cleveland, USA Mid-West","Colombus, USA Mid-West","Detroit, USA Mid-West","Indianapolis, USA Mid-West","Kansas, USA Mid-West","Loiusville, USA Mid-West","Minneapolis, USA Mid-West","St. Cloud, USA Mid-West","St. Louis, USA Mid-West","St. Paul, USA Mid-West","Atlanta, USA South-East","Baton Rouge, USA South-East","Beaumont, USA South-East","Brownsville, USA South-East","Charleston, USA South-East","Chattanooga, USA South-East","Corpus Christi, USA South-East","Dallas, USA South-East","Fort Worth, USA South-East","Galveston, USA South-East","Gulf Port, USA South-East","Houston, USA South-East","Jacksonville, USA South-East","Memphis, USA South-East","Miami, USA South-East","Mobile, USA South-East","Morisstown, USA South-East","Nashville, USA South-East","New Orleans, USA South-East","Norfolk, USA South-East","Port Everglades, USA South-East","Portsmouth, USA South-East","Richmond, USA South-East","Savannah, USA South-East","Tampa, USA South-East","Tulsa, USA South-East","Wilmington, USA South-East","Alameda, USA South-West","Denver, USA South-West","Long Beach, USA South-West","Los Angeles, USA South-West","Monterey, USA South-West","Oakland, USA South-West","Phoenix, USA South-West","Sacramento, USA South-West","San Francisco, USA South-West","San Diego, USA South-West","San Pedro, USA South-West","Stockton, USA South-West","Birmingham, UK","Cardiff, UK","Felixstowe, UK","Greenock, UK","Hull, UK","Immingham, UK","Leeds, UK","Liverpool, UK","London, UK","Manchester, UK","Newport, UK","Plymouth, UK","Port Talbot, UK","Nottingham, UK","Sheerness, UK","Southampton, UK","Southshield, UK","Sunderland, UK","Thamesport, UK","Tilbury, UK","Montevideo, Uruguay","Nueva Palmira, Uruguay","Abu Dhabi, U.A.E","Dubai, U.A.E","Fujairah, U.A.E","Jebel Ali, U.A.E","Khorfakkan, U.A.E","Dhor Al Fakkan, U.A.E","Port Rashid, U.A.E","Sharjah, U.A.E","Ilychevsk, Ukraine","Izmail, Ukraine","Odessa, Ukraine","Caracus, Venezuela","La Guaira, Venezuela","Maracaibo, Venezuela","Puerto Cabello, Venezuela","Puerto Sucre, Venezuela","Cantho, Vietnam","Caobang, Vietnam","Dalat, Vietnam","Danang, Vietnam","Donghoi, Vietnam","Haiduong, Vietnam","Haiphong, Vietnam","Hanoi, Vietnam","Ho Chi Minh City, Vietnam","Honggai, Vietnam","Hue, Vietnam","Laichau, Vietnam","Mongcai, Vietnam","My Tho, Vietnam","Namdinh, Vietnam","Nha Trang, Vietnam","Pleycu, Vietnam","Quangngai, Vietnam","Quangtri, Vietnam","Quinhon, Vietnam","Sonla, Vietnam","Thai Binh, Vietnam","Thanhhoa, Vietnam","Tuyhoa, Vietnam","Vinh Phu, Vietnam","Vinh, Vietnam","Vungtau, Vietnam","Yenbai, Vietnam","Apia, Western Samoa","Pago Pago, Western Samoa","Koper, Yugoslavia","Aden, Yemen","Hodeidah, Yemen","Mukalla, Yemen","Bulawayo, Zimbabwe","Harare, Zimbabwe","Salisbury, Zimbabwe","Lusaka, Zambia","Matadi, Zaire",};
  /*spinner*/ final String[] destcount = {"Alaska","Albania","Algeria","Angola","Antigua","Argentina","Aruba","Afghanisthan","Australia","Austria","Bahamas","Bahrain","Bangladesh","Barbados","Belize","Benin","Brazil","Brunei","Belgium","Bulgaria","Croatia","Cambodia","Cameroon","Canada","Canary Islands","Caroline","Cote D'Ivoire","Chile","China","Columbia","Comoros Islands","Congo","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominican Republic","Dominica","Estonia","Ecuador","Egypt","Estonia","El Salvador","Ethiopia","Fiji","Finland","France","Greece","Gabon","Gambia","Germany","Ghana","Gilbert","Grand Cayman","Grenada","Guatemala","Guam","Guinea","Guyana","Haiti","Hawaii","Honduras","Hungary","Iceland","Ireland","Italy","Iran","Iraq","Israel","Indonesia","Jamaica","Jordan","Japan","Jamaica","Kenya","Korea","Kuwait","Latvia","Libya","Liberia","Lebanon","Macau","Malaysia","Malagasy","Mauritiana","Mozambique","Morocco","Madagascar","Myanmar","Malta","Martinique","Malawi","Mauritius","Mexico","Maldives","Montserrat","Marshall","Micronesia","Mariana","Namibia","New Herbrides","Nicaragua","Netherlands Antilles","Netherlands","Norway","Nigeria","New Zealand","New Caledonia","Oman","Panama","Peru","Puerto Rico","Poland","Portugal","Pakistan","Philippines","Papua New Guinea","Qatar","Romania","Russia","Peunion Islands","Singapore","Solomon Islands","Senegal","Sierra Leone","Seychelles","Somalia","Sudan","Surinam","Scotland","Spain","Sweden","Switzerland","Syria","Saudi Arabia","South Africa","Trinidad","Tunisia","Turkey","Taiwan","Thailand","Tanzania","Togo","Tuvalu","Tonga","Tahiti","USA","UK","Uruguay","U.A.E","Ukraine","Venezuela","Vietnam","Western Samoa","Yugoslavia","Yemen","Zimbabwe","Zambia","Zaire"};
  String selected;
  
  Intent i;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_destination);
  
      i = getIntent();
  
      aa1 = new ArrayAdapter&lt;String&gt;(Destination.this,R.layout.loginlist,dest);
      aa2 = new ArrayAdapter&lt;String&gt;(Destination.this,R.layout.loginlist,destcount);
  
      Spinner s = (Spinner) findViewById(R.id.spinner1);
      s.setAdapter(aa2);
  
      s.setOnItemSelectedListener(new OnItemSelectedListener() {
  
          @Override
          public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
              aa1.getFilter().filter(destcount[position]);
  
          }
  
          @Override
          public void onNothingSelected(AdapterView&lt;?&gt; parent) {
  
              aa1.getFilter().filter(destcount[0]);
  
          }
      });
  
      ListView lv = (ListView) findViewById(R.id.listView1);
      lv.setAdapter(aa1);
  
      lv.setOnItemClickListener(new OnItemClickListener() {
  
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
              i.putExtra("selected2", aa1.getItem(position));
              setResult(RESULT_OK, i);
              finish();
  
          }
      });
  
  
  
  
  }
  
  
  }
  </code></pre>