Answer the question
In order to leave comments, you need to log in
How to make a common variable for two fragments?
Good afternoon. There is a RecyclerView in Fragment #1 and Fragment 2 with a couple of buttons. Both fragments are inside ViewPager. From Fragment #1, by clicking on the button, I can add items to the RecyclerView, but I want to do this from Fragment #2. That is, by pressing a button in the fragment, create one item for the Recyclerview and place it without going to the fragment with the RecyclerView. My idea is to make a generic adapter, set it in a fragment with a RecyclerView, and add items in a fragment without a RecyclerView. What's the best way to do this?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question