title: Android : Search from Large Arraylist
body: <p>I have a recordset of about 29,000 records. My Screen contains EditText Box for Search Criteria and Listview containing all 29,000 records.</p>
  
  <p>By searching with the listed way it takes time and not giving flow less output as I need.</p>
  
  <p>My EditText contains</p>
  
  <pre><code>final EditText txtSearchCity = (EditText) findViewById(R.id.edtCity);
          txtSearchCity.addTextChangedListener(new TextWatcher() {
              @Override
              public void afterTextChanged(Editable s) {
              }
  
              @Override
              public void beforeTextChanged(CharSequence s, int start, int count,
                      int after) {
              }
  
              @Override
              public void onTextChanged(CharSequence s, int start, int before,
                      int count) {
                  aCountryIDTemp.clear();
                  aCityStateTemp.clear();
  
                  for (int i = 0; i &lt; aCountryID.size(); i++) {
                      if (aCityState
                              .get(i)
                              .toLowerCase()
                              .contains(
                                      txtSearchCity.getText().toString()
                                              .toLowerCase())) {
                          aCountryIDTemp.add(aCountryID.get(i));
                          aCityStateTemp.add(aCityState.get(i));
                      }
                  }
  
                  BindList();
              }
          });
      }
  </code></pre>
  
  <p>BindList() method is setting the arraylist aCityStateTemp to adapter.
  Any Other way to Search and Create new ArrayList dynamically.</p>