Is there any way to pass data from Fragment to it's Adapter's onBindViewHolder?

一世执手 提交于 2019-11-28 13:11:33

I think you can pass item to MyAdapter.

Change the constructor of MyAdapter like this:

public class MyAdapter extends RecyclerView.Adapter {

    private ArrayList<MyLessons> mondayLessons;
    private int item

    public MyAdapter(ArrayList<MyLessons> mondayLessons, inte item) {
        this.mondayLessons = mondayLessons;
        this.item = item;
    }

    ...

}

Pass item to MyAdapter.

mAdapter = new MyAdapter(lessons, item);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!