title: Bypassing the bug in filtering that does not update ListView Android
body: <p>Here is the code, I used a custom adapter, and applied the Filter method, now the ListView does not update when the backspace key is entered, on when one switches back from an item activity. I read it is a bug in filter, but how do I bypass it, I know of apps that have achieved this kind of setup I want.</p>
  
  <pre><code>public class IndexPageActivity extends Activity implements OnItemClickListener{ 
      ListView listView;
      EditText editTextB;
      PagesAdapter adapter1;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          setContentView(R.layout.activity_main);
          listView = (ListView) findViewById(R.id.pageList);
          editTextB = (EditText) findViewById(R.id.searchB);
          adapter1 = new PagesAdapter(this);
          listView.setAdapter(adapter1);
          adapter1.notifyDataSetChanged();
          listView.setOnItemClickListener(this);
  
          editTextB.addTextChangedListener(new TextWatcher() {
              @Override
              public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
                  IndexPageActivity.this.adapter1.getFilter().filter(cs.toString());
                  adapter1.notifyDataSetChanged();
              }
  
              @Override
              public void beforeTextChanged(CharSequence arg0, int arg1,
                          int arg2, int arg3) { }
  
              @Override
              public void afterTextChanged(Editable arg0) { }
          });
      }
  
      @Override
      public void onItemClick(AdapterView&lt;?&gt; arg0, View v, int position, long arg3) {
          Intent i;
          String name = adapter1.getItem(position);
          Log.d("id", name);
  
          if (name.equals("Item1"))
          {
              i = new Intent(this, anActivity.class);
              startActivity(i);
          }
          else if (name.equals("Item2"))
          {
              i = new Intent(this, anActivity2.class);
              startActivity(i);
          }
      }
  }
  
  class SingleRow {
      String pagedata;
      SingleRow(String pagedata){
          this.pagedata=pagedata;
      }
  }
  class PagesAdapter extends BaseAdapter implements Filterable{
      ArrayList&lt;String&gt; pagelist;
      List&lt;String&gt; arrayList;
      Context context;
      String [] pagedatas;
  
      PagesAdapter(Context c){
          context=c;
          pagelist = new ArrayList&lt;String&gt;();
          Resources res = c.getResources();
          pagedatas = res.getStringArray(R.array.pages_data);
          for (int i=0;i&lt;463;i++){
              pagelist.add(pagedatas[i]);
          }
      }
      @Override
      public int getCount() {
          return pagelist.size();
      }
  
      @Override
      public String getItem(int i) {
          return pagelist.get(i);
      }
  
      @Override
      public long getItemId(int i) {
          return i;
      }
  
      @Override
      public View getView(int i, View view, ViewGroup viewG) {
          LayoutInflater inflater=(LayoutInflater)             context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          View row=inflater.inflate(R.layout.single_row,viewG,false);
          TextView pagetitle = (TextView) row.findViewById(R.id.textViewRow);
  
          String temp=pagelist.get(i);
  
          pagetitle.setText(temp);
          return row;
      }
  
      public class filter_here extends Filter{
          @Override
          protected FilterResults performFiltering(CharSequence constraint) {
              FilterResults Result = new FilterResults();
              // if constraint is empty return the original names
              if(constraint.length() == 0 ){
                  Result.values = pagelist;
                  Result.count = pagelist.size();
                  return Result;
              }
  
              ArrayList&lt;String&gt; Filtered_Names = new ArrayList&lt;String&gt;();
              String filterString = constraint.toString().toLowerCase();
              String filterableString;
  
              for(int i = 0; i&lt;pagelist.size(); i++){
                  filterableString = pagelist.get(i);
                  if(filterableString.toLowerCase().contains(filterString)){
                      Filtered_Names.add(filterableString);
                  }
              }
              Result.values = Filtered_Names;
              Result.count = Filtered_Names.size();
  
              return Result;
          }
  
          @Override
          protected void publishResults(CharSequence constraint,FilterResults results) {
              pagelist = (ArrayList&lt;String&gt;) results.values;
              notifyDataSetChanged();
          }
      }
  
      @Override
      public Filter getFilter() {
          return new filter_here();
      }
  }
  </code></pre>