Search code examples
javaandroidandroid-fragmentsandroid-recyclerviewandroid-json

How to refresh first recyclerview data when user clicks on second recyclerview items


I have first recyclerview in Main Activity and second recycler is in Fragment. I want when user clicks on first recycler item then second recyclerview data should refresh according to the clicked item.

I am still a beginner i dont know how to achieve this? Please help me. Thanks.


Solution

  • Sorry, I think the comment would be more appropriate, but you should describe your problem more clearly.

    I still don't understand what this is for, but I can give you a few pointers:

    1. If the recyclerview in Fragment gets data from Activity, you can transfer it by setArguments.

    2. If the data is not very dependent on Activity, you can write a refresh function in Fragment, then call it from Activity.

    Hope it can help you.