Created
January 17, 2017 05:25
-
-
Save pyeongho/fbe79093772cfa1b62fc3f97659bdaed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private List<Recent> items= null; | |
private ArrayList<Recent> arrayList; | |
public RecyclerAdapter(Context context, List<Recent> items) { | |
this.mCtx=context; | |
this.items=items; | |
arrayList = new ArrayList<Recent>(); | |
arrayList.addAll(items); | |
} | |
public void filter(String charText) { | |
charText = charText.toLowerCase(Locale.getDefault()); | |
items.clear(); | |
if (charText.length() == 0) { | |
items.addAll(arrayList); | |
} else { | |
for (Recent recent : arrayList) { | |
String name = recent.getAddress(); | |
if (name.toLowerCase().contains(charText)) { | |
items.add(recent); | |
} | |
} | |
} | |
notifyDataSetChanged(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment