Detailed Android Application Development — code implementation of MP3 music player (I)

Requirement 1: read out the MP3 music in the memory card and display it in the list

1. Query all music data from the database and save it to the list collection, where mp3info objects are stored

2. Iterate over the list set and save all the attributes of each mp3info object to the map object

3. Define a list set and add the map object to the list set

4. Define a simpleadpter and call setadpter method to display the data in the list

The implementation effect is shown in the figure:

Requirement 2: click each item in the list to start a service to play music

1. Register the entry and click the listener onitemclicklistener

2. Define an internal class that implements the onitemclicklistener interface

3. Define a service class playerservie that inherits service

1. Register the entry and click the listener onitemclicklistener

2. Define an internal class that implements the onitemclicklistener interface

3. Define a service class playerservie (imperfect service class) that inherits service

The above code realizes two requirements, displaying the music list and realizing the list. Click the event to start the service. The need to control music playback will be realized next time. I hope it will help you in your study, and I also hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>