Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><em><strong>i hope this example could help you</em></strong></p> <p>in the Main_Activity</p> <pre><code> EditText etSearch; BaseAdapterFilterable adapter; etSearch.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // Listview name of the class Listview.this.adapter.getFilter().filter(s); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub } }); </code></pre> <p>in your adapter put this class to use it in getfilter method</p> <pre><code>public class filter_here extends Filter{ @Override protected FilterResults performFiltering(CharSequence constraint) { // TODO Auto-generated method stub FilterResults Result = new FilterResults(); // if constraint is empty return the original names if(constraint.length() == 0 ){ Result.values = Original_Names; Result.count = Original_Names.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;Original_Names.size(); i++){ filterableString = Original_Names.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) { // TODO Auto-generated method stub Names = (ArrayList&lt;String&gt;) results.values; notifyDataSetChanged(); } } </code></pre> <p>also in your adapter return instance from <strong>filter_here</strong> class </p> <pre><code>@Override public Filter getFilter() { // TODO Auto-generated method stub return filter; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload