简体   繁体   English

单击第一个回收器视图项目单击时调用第二个回收器视图数据

[英]Call Second Recycler view Data on click of first recycler view item click

I have two recycler-view one below another. 我有两个回收站视图,一个接一个。 I want to load each sub item of Second recycler-view data on item click of first Recycler-view. 我想在“第一个回收者视图”的项目单击上加载“第二个回收者视图”数据的每个子项目。 I am using custom RecyclerTouchListener to load data.Please let me know the proper solution. 我正在使用自定义的RecyclerTouchListener加载数据。请让我知道正确的解决方案。

Thanks in advance 提前致谢

recyclerView.addOnItemTouchListener(new RecyclerTouchListener(this, recyclerView, new RecyclerTouchListener.ClickListener() {
        @Override
        public void onClick(View view, int position) {

            Product allEventDatum = productList.get(position);

            categoryss = allEventDatum.getCategory();


        }

        @Override
        public void onLongClick(View view, int position) {

        }
    }));

Try This : 尝试这个 :

recyclerViewOne.addOnItemTouchListener(new RecyclerTouchListener(this, recyclerView, new RecyclerTouchListener.ClickListener() {
    @Override
    public void onClick(View view, int position) {

        Product allEventDatum = productList.get(position);
        categoryss = allEventDatum.getCategory();

        // get your first item from first recycler view and save it in string/int
        // then pass that stored value to your API to get data according to get relevant data in the second recycler view

    }

    @Override
    public void onLongClick(View view, int position) {

    }
}));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM