title: Autocomplete edit text filtering based on two different data columns
body: <p>I am following an example for doing an autocomplete in my app,the code I am following is</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      mList = retrievePeople();
      txtSearch = (AutoCompleteTextView) findViewById(R.id.txt_search);
      txtSearch.setThreshold(1);
      adapter = new PeopleAdapter(this, R.layout.activity_main, R.id.lbl_name, mList);
      txtSearch.setAdapter(adapter);
  }
  
  private List&lt;People&gt; retrievePeople() {
      List&lt;People&gt; list = new ArrayList&lt;People&gt;();
      list.add(new People("James", "Bond", 1));
      list.add(new People("Jason", "Bourne", 2));
      list.add(new People("Ethan", "Hunt", 3));
  
      return list;
  }
  </code></pre>
  
  <p>And adapter is</p>
  
  <pre><code>public PeopleAdapter(Context context, int resource, int textViewResourceId, List&lt;People&gt; items) {
      super(context, resource, textViewResourceId, items);
      this.context = context;
      this.resource = resource;
      this.textViewResourceId = textViewResourceId;
      this.items = items;
      tempItems = new ArrayList&lt;People&gt;(items); // this makes the difference.
      suggestions = new ArrayList&lt;People&gt;();
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
      View view = convertView;
      if (convertView == null) {
          LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          view = inflater.inflate(R.layout.row_people, parent, false);
      }
      People people = items.get(position);
      if (people != null) {
          TextView lblName = (TextView) view.findViewById(R.id.lbl_name);
          if (lblName != null)
              lblName.setText(people.getName());
      }
      return view;
  }
  
  @Override
  public Filter getFilter() {
      return nameFilter;
  }
  
  /**
   * Custom Filter implementation for custom suggestions we provide.
   */
  Filter nameFilter = new Filter() {
      @Override
      public CharSequence convertResultToString(Object resultValue) {
          String str = ((People) resultValue).getFirstName();
          return str;
      }
  
      @Override
      protected FilterResults performFiltering(CharSequence constraint) {
          if (constraint != null) {
              suggestions.clear();
              for (People people : tempItems) {
                  if (people.getFirstName().toLowerCase().contains(constraint.toString().toLowerCase())) {
                      suggestions.add(people);
                  }
              }
              FilterResults filterResults = new FilterResults();
              filterResults.values = suggestions;
              filterResults.count = suggestions.size();
              return filterResults;
          } else {
              return new FilterResults();
          }
      }
  
      @Override
      protected void publishResults(CharSequence constraint, FilterResults results) {
          List&lt;People&gt; filterList = (ArrayList&lt;People&gt;) results.values;
          if (results != null &amp;&amp; results.count &gt; 0) {
              clear();
              for (People people : filterList) {
                  add(people);
                  notifyDataSetChanged();
              }
          }
      }
  };
  </code></pre>
  
  <p>Here the search is happening based on first name but I want search to happen based on both first name and last name.Both First name and last name should appear in the filter 
  Kindly help,thanks in advance.</p>