Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Probably the most basic need for multimedia on a cell phone is the ability to play audio files, whether new ringtones, MP3s, or quick audio notes. Android’s MediaPlayer is easy to use. At a high level, all you need to do to play an MP3 file is follow these steps:
1. | Put the MP3 in the res/raw directory in a project (note that you can also use a URI to access files on the network or via the internet). |
2. | Create a new instance of the MediaPlayer, and reference the MP3 by calling MediaPlayer.create(). |
3. | Call the MediaPlayer methods prepare() and start(). |