Answer the question
In order to leave comments, you need to log in
How to make RecyclerView open another RecycleView and populate it with data depending on the selected item?
Here is an example from the McDonalds application, where in the "Menu" fragment there is a RecyclerView, when you click on any element of which, exactly the same RecyclerView appears (only with a changed content that depends on the selected element), and the next time you click it repeats again. How can you implement exactly the same navigation? (and how to pass data about the selected button in such a complex structure) Who has already encountered this?
Answer the question
In order to leave comments, you need to log in
Right from the description, two options come to mind: recreate a fragment with a recycler or create a new adapter for the current recycler
You need to leave your thoughts with the level of recyclerview. This element only displays data, it will not open anything. You need to take fragments (Fragment), and organize a hierarchy of screens on them. Provide what data is needed in the next screen, pass it to the appropriate fragment and display it.
pass an action handler to the adapter
in the adapter
handler implementation in fragment
ISomeKindChangeDataCallback callback = new ISomeKindChangeDataCallback() {
void doChangeData(int param1,....) {
//если данные уже есть то
adaper.setData(новые данные).doRefreshNowAndImmediatelly();
//иначе запросить данные
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question