Android LifeCycle and MedialPlayer
As a user navigates through, out of, and back to your app, the Activity instances in your app transition through different states in their life-cycle. The Activity class provides a number of callbacks methods that allow the activity to know that a state has changed: that the system is creating, pausing, stopping, resuming, or destroying an activity.
The Android MediaPlayer supports for playing variety of common media types, so that you can easily integrate audio, video and images into your applications. In this video, we show how to play audio from media file stored in your application's resources (raw resources). Also we show how to use Android life-cycle callback method to control audio playing.