S
S
SimpleName2019-02-01 10:50:02
Java
SimpleName, 2019-02-01 10:50:02

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?
5c53fa183e541233196413.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
one pavel, 2019-02-01
@onepavel

Right from the description, two options come to mind: recreate a fragment with a recycler or create a new adapter for the current recycler

D
Denis Zagaevsky, 2019-02-01
@zagayevskiy

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.

D
Dmtm, 2019-02-01
@Dmtm

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 question

Ask a Question

731 491 924 answers to any question