• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Correct Architecture for Bottom Nav?

adrem7

Lurker
May 8, 2020
1
0
I want to make a music app, very simple, using ExoPlayer. It will have a bottom nav with "songs" as the landing page, a recycler view of all songs in the library, with a player at the bottom of the view. Other areas of the app will be "albums", "artists" and "playlists". These again will be recycler views, but you click on something in these recycler views, and instead of playing, like in "songs", you will be taken to a recycler view of songs contained within that item i.e. I select Artist "Daft Punk", I get a list of Daft Punk songs with the player at the bottom, I click a song in that list and it plays.

So my decision is how to architect this and as I am new to android I honestly don't know the right way. I have done some reading and thing I am right in saying that I would have 1 activity (the nav bar activity). From this, I would have 4 fragments, one for each of the items in the bottom nav. I would then pass a list of all songs to the songs fragment on opening the app, or tapping the "Songs" nav item. But I would pass a different list of songs to the "Songs" fragment if I were navigating through one of the other areas.

Is this the correct approach? I haven't worked much with fragments so am a little wary that this might be a bit dumb... The alternative I though of was to have one child fragment each off of artists, playlists and albums which are essentially a copy of the songs fragment, but this seems like too much duplication. A little guidance here would be appreciated.

I have drawn something simple here to explain what I mean. Haven't added media on this site before so hoping this works correctly.
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones