Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Java
- public class MyAdapter extends RecyclerView.Adapter<RecyclerAdapter.ListViewHolder> {
- private ArrayList<MyRepo> myRepoList;
- public RecyclerAdapter(ArrayList<MyRepo> myRepoList) {
- this.myRepoList = myRepoList;
- }
- // ....
- public void setFilter(List<MyRepo> list) {
- myRepoList = new ArrayList<>();
- myRepoList.addAll(list);
- notifyDataSetChanged();
- }
- }
- // Kotlin
- class MyAdapter (private var myRepoList: ArrayList<MyRepo>) : RecyclerView.Adapter<RecyclerAdapter.ListViewHolder>() {
- // ....
- fun setFilter(list: List<MyRepo>) {
- myRepoList = ArrayList<MyRepo>()
- myRepoList.addAll(list!!)
- notifyDataSetChanged()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement