title: Searchview in custom ArrayAdapter
body: <p>I have a custom 'ArrayAdapter' in a 'ListView', my problem is using a menu 'SearchView'. It's not working properly. I don´t know if the problem is searching or showing the results, because nothing appears. And, if possible, I wnat to show a custom list of results. Thanks!</p>
  
  <p>Fragment with the adapter</p>
  
  <pre><code> ArrayList&lt;Favoritos&gt; favorites;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      // Inflate the layout for this fragment
  
      View rootView = inflater.inflate(R.layout.list_item, container, false);
      favorites = new ArrayList&lt;Favoritos&gt;();
      favorites.add(new Favorites("Title", "addres", 5, false, 7, 22, 4.5f));
      favorites.add(new Favorites("Title", "addres", 3.5 , true, 7, 22, 3.0f));
      favorites.add(new Favorites("Title", "addres", 2, false, 7, 22, 4.0f));
      favorites.add(new Favorites("Titleo", "addres", 4.5, true, 7, 22, 5.0f));
  
      FavoritesAdapter adapter = new FavoritesAdapter(getActivity(), favorites);
  
      ListView listView = (ListView) rootView.findViewById(R.id.list_item);
  
      listView.setAdapter(adapter);
   }
  
  
   @Override
  public boolean onQueryTextSubmit(String s) {
      return false;
  }
  
  @Override
  public boolean onQueryTextChange(String string) {
      search(string);
      return true;
  }
  
  //This is the search method
  public void search(String s) {
      if (s == null || s.trim().equals("")) {
          cleanSearch(); //In this method I just "reset" the adapter when the user "give up"
          return;
      }
  
      ArrayList&lt;Favoritos&gt; estacionamentosEncontrados = new ArrayList&lt;Favoritos&gt;(favoritos);
  
      for (int i = estacionamentosEncontrados.size() - 1; i &gt;= 0; i--) {
          Favoritos estacionamento = estacionamentosEncontrados.get(i);
          Favoritos nenhumResultado = new Favoritos("Nenhum resultado encontrado");
          if (!estacionamento.mIndicacao.toUpperCase().contains(s.toUpperCase())) {
              estacionamentosEncontrados.remove(estacionamento);
          } else {
              estacionamentosEncontrados.add(nenhumResultado);
          }
      }
  
      adapter = new EncontradosAdapter(getActivity(), estacionamentosEncontrados);
      ListView listView = (ListView) getActivity().findViewById(R.id.list_item);
      listView.setAdapter(adapter);
  }
  </code></pre>
  
  <p>Favorites.java</p>
  
  <pre><code>   public String mIndicacao;
     public String mEndereco;
     private double mPreco;
     public boolean mDisponibilidade;
     private double mHoraAbre;
     private double mHoraFecha;
     private float mAvaliacao;
  
     public Favoritos(){
  
     }
  
    public Favoritos(String indicacao, String endereco, double preco, boolean disponibilidade, double horaAbre, double horaFecha, float avaliacao){
      mIndicacao = indicacao;
      mEndereco = endereco;
      mPreco = preco;
      mDisponibilidade = disponibilidade;
      mHoraAbre = horaAbre;
      mHoraFecha = horaFecha;
      mAvaliacao = avaliacao;
  }
  
  //Getters and Setters
  </code></pre>
  
  <p>And the custom Adapter</p>
  
  <pre><code>public class FavoritesAdapter extends ArrayAdapter&lt;Favorites&gt; {
  
  
  public FavoritesAdapter(Context context, ArrayList&lt;Favorites&gt; favorites){
      super(context, 0, favoritos);
  }
  
  public static class ItemViewHolder{
      TextView indicadorTextView;
      TextView enderecoTextView;
      TextView precoTextView;
      TextView horaAbreTextView;
      TextView horaFechaTextView;
      RatingBar notaEstacionamento;
      ImageView disponivelImg;
      TextView disponivelTextView;
      ImageView esconderView;
  
      public ItemViewHolder(View view){
          indicadorTextView = (TextView) view.findViewById(R.id.indicador);
          enderecoTextView = (TextView) view.findViewById(R.id.endereco);
          precoTextView = (TextView) view.findViewById(R.id.precoValor);
          horaAbreTextView = (TextView) view.findViewById(horaAbre);
          horaFechaTextView = (TextView) view.findViewById(horaFecha);
          notaEstacionamento = (RatingBar) view.findViewById(R.id.ratingBar);
          disponivelImg = (ImageView) view.findViewById(R.id.img_disponibilidade);
          disponivelTextView = (TextView) view.findViewById(R.id.disponivel);
          esconderView = (ImageView) view.findViewById(R.id.esconder_view_btn);
  
      }
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
      // Check if an existing view is being reused, otherwise inflate the view
      View listItemView = convertView;
      if (listItemView == null) {
          listItemView = LayoutInflater.from(getContext()).inflate(
                  R.layout.favorites_item, parent, false);
      }
  
      Favorites currentFavorito = getItem(position);
  
      final ItemViewHolder holder;
  
      if(listItemView.getTag() == null){
          holder = new ItemViewHolder(listItemView);
          listItemView.setTag(holder);
      } else {
          holder = (ItemViewHolder) listItemView.getTag();
      }
  
      if(currentFavorito.getDisponibilidade()){
          holder.disponivelTextView.setText(currentFavorito.getIndicacao());
      } else {
          holder.disponivelTextView.setText(currentFavorito.getIndicacao());
      }
      holder.indicadorTextView.setText(currentFavorito.getIndicacao());
      holder.enderecoTextView.setText(currentFavorito.getEndereco());
      holder.precoTextView.setText(currentFavorito.getPreco());
      holder.horaAbreTextView.setText(currentFavorito.getHoraAbre());
      holder.horaFechaTextView.setText(currentFavorito.getHoraFecha());
      holder.notaEstacionamento.setRating(currentFavorito.getAvaliacao());
  
  
      if(currentFavorito.getDisponibilidade()){
          holder.disponivelImg.setImageResource(R.drawable.ir_img);
          holder.disponivelTextView.setText(R.string.aberto);
          holder.disponivelTextView.setTextColor(getContext().getResources().getColor(R.color.verde));
      } else {
          holder.disponivelImg.setImageResource(R.drawable.fechado_img);
          holder.disponivelTextView.setText(R.string.fechado);
          holder.disponivelTextView.setTextColor(getContext().getResources().getColor(R.color.vermelho));        }
  
      return listItemView;
  }
  </code></pre>
  
  <p>}</p>