1. Are you ready for the Galaxy S20? Here is everything we know so far!

Correct Architecture for Bottom Nav?

Discussion in 'Android Development' started by adrem7, May 8, 2020.

  1. adrem7

    adrem7 Lurker
    Thread Starter

    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.
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...

Share This Page

Loading...