title: search algorithm in phone contacts android
body: <p>in my application I get a list of contacts from the phone.
  I need to implement a context filter / search mechanism through the list of contacts.</p>
  
  <p>FILTER CONDITION:
  Filter by contact name in accordance with the letters of which are located on the numeric keys (all possible combinations)!</p>
  
  <p>When i enter each new number list should be changed leaving only suitable contacts.</p>
  
  <p>Like here. </p>
  
  <p><a href="http://i.stack.imgur.com/IXZmJ.png" rel="nofollow">http://i.stack.imgur.com/IXZmJ.png</a></p>
  
  <p>I input "253" and application finds to me ALE.
  Please help me to do this.</p>
  
  <pre><code>private List&lt;Contact&gt; contacts = new ArrayList&lt;Contact&gt;();
  private List&lt;Contact&gt; sortContacts = new ArrayList&lt;Contact&gt;();
  int textlength = 0;
  TextView textView;
  
  private class CustomTextWatcher implements TextWatcher {
  
      public void onTextChanged(CharSequence s, int start, int before,
              int count) {
          textlength = textView.getText().length();
  
          for (int i = 0; i &lt; contacts.size(); i++) {
              if (textlength &lt;= contacts.get(i).getName().length()) {
                              // need help here
                                                                         }}}}
  </code></pre>