Question

I would like to add music controls such as play/pause, next, and back as well as show a thumbnail and song title to the bottom of an application like in the Google music app.
So this When the thumbnail or title is tapped on, I want to bring up a detailed view of song, including a seek bar.
Like this I am wondering what the best approach for this would be. Should I just add a relative layout the the bottom of my apps xml, and add on click listeners, or can this be accomplished simply with something like the MediaController class?

Was it helpful?

Solution

You should use fragments to build your app. Google has deprecated a number of previous API features in favor of fragments, and is trying to move developers towards using them more in new applications.

Assuming you're creating a media player, the song list portion of your app's main screen will be a ListView within a fragment, and the bottom controller portion will be another fragment containing whatever buttons and sliders you'd like to have.

How you create a detailed screen showing information about the song depends on what you want that screen to look like, but the most straightforward way to do so would be to display the album thumbnail as an ImageButton within your "controller" fragment and create a new Activity onClick.

You can find information about fragments here and a tutorial on building an audio player for Android here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top