Reputation: 43
In my application, I have multiple dynamic lists in which the user can navigate between them. For simplification, the app has a main screen which shows a list of items. When the user clicks on any of the items, a new list should be shown, and again if he/she clicks on an item again, a new list should be shown. Moreover, the user should have the ability to navigate back to the previous screen.
I considered two options for implementing this:
Using the same recyclerview and change the content when needed.
Using fragment with recyclerview and replace the fragment with a new fragment that shown a recyclerview with the new content.
My question is about the implications of each of these implementations, especially in term of efficiency and user experience, or if someone can suggest a better approach to this situation. I know a little about fragments and recyclerview, and I think that using fragment might be preferable since it is suitable if I ever plan to make the application fit into tablets and devices with a bigger screen. I planned to test both to understand them better. However, I still hoped to hear more opinions.
I would like to thanks in advance to anyone who will share his opinion with me.
Upvotes: 1
Views: 47
Reputation: 58934
I will suggest you use fragments for this implementation. So that you don't write huge lines file in one class.
Also it will reduce future problems if app will upgrade and UI or functionality changes, then you will have separate code to change.
Keeping adapters and fragments separate will lead more efficient way to manage user interactions.
Also you don't need to maintain views stack, android will take care of backpress itself.
Upvotes: 1
Reputation: 136
I think Using fragment with recyclerview and replace the fragment with a new fragment that shown a recyclerview with the new content is pref rebel because if you need some ui changes also fragment will be good choice.
Upvotes: 1