title: Android - How to filter a listview on multiple values?
body: <p>I want to filter a listView on song title and artist.</p>
  
  <p>Currently I have a working filter on song title. But I can't figure out how to filter on song title and artist at the same moment.</p>
  
  <p>This is my activity:</p>
  
  <pre><code>listView.setTextFilterEnabled(true);
  inputSongTitle.addTextChangedListener(new TextWatcher() {
  
      @Override
      public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
          adapterCorrectSong.getFilter().filter(cs);
      }
  
      @Override
      public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
                                    int arg3) {
      }
  
      @Override
      public void afterTextChanged(Editable s) {
      }
  });
  </code></pre>
  
  <p>I use this code in my ArrayAdapter:</p>
  
  <pre><code>@Override
  public Filter getFilter() {
      if (songFilter == null){
          songFilter  = new SongFilter();
      }
      return songFilter;
  }
  
  private class SongFilter extends Filter
  {
      @Override
      protected FilterResults performFiltering(CharSequence constraint) {
  
          constraint = constraint.toString().toLowerCase();
          FilterResults result = new FilterResults();
          if(constraint != null &amp;&amp; constraint.toString().length() &gt; 0)
          {
              ArrayList&lt;CorrectSongResponse&gt; filteredItems = new ArrayList&lt;CorrectSongResponse&gt;();
  
              for(int i = 0, l = allModelItemsArray.size(); i &lt; l; i++)
              {
                  CorrectSongResponse m = allModelItemsArray.get(i);
                  if(m.getTitle().toLowerCase().contains(constraint.toString())) {
                      filteredItems.add(m);
                  }
              }
              result.count = filteredItems.size();
              result.values = filteredItems;
          }
          else
          {
              synchronized(this)
              {
                  result.values = allModelItemsArray;
                  result.count = allModelItemsArray.size();
              }
          }
          return result;
      }
  
      @SuppressWarnings("unchecked")
      @Override
      protected void publishResults(CharSequence constraint, FilterResults results) {
  
          filteredModelItemsArray = (ArrayList&lt;CorrectSongResponse&gt;)results.values;
          notifyDataSetChanged();
          clear();
          for(int i = 0, l = filteredModelItemsArray.size(); i &lt; l; i++)
              add(filteredModelItemsArray.get(i));
          notifyDataSetInvalidated();
      }
  }
  </code></pre>
  
  <p>I now want to add an addTextChangedListener to "inputSongArtist". How can I filter both on Title and Artist at the same time?</p>