Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. public Filter getFilter() {
  2. return new Filter() {
  3. @Override
  4. protected FilterResults performFiltering(CharSequence constraint) {
  5. final FilterResults oReturn = new FilterResults();
  6. final ArrayList<Info_Filter> results = new ArrayList<Info_Filter>();
  7. if (orig == null)
  8. orig = items;
  9. if (constraint != null) {
  10. if (orig != null & orig.size() > 0) {
  11. for (final Info_Filter g : orig) {
  12. if (g.getName().toLowerCase().contains(constraint.toString()))
  13. results.add(g);
  14. }
  15. }
  16. oReturn.values = results;
  17. }
  18. return oReturn;
  19. }
  20.  
  21. @Override
  22. protected void publishResults(CharSequence constraint, FilterResults results) {
  23. items = (ArrayList<Info_Filter>) results.values;
  24. notifyDataSetChanged();
  25. }
  26. };
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement