Android Quick Help

Home

  • Home
  • Quick Tips
  • Android Sample Examples
  • Android Devoloper

Android: How to Stop Media Player play when Home button is pressed


Here is the solution, tested and verified

@Override
protected void onPause() {
        if (mediaPlayer != null) {
            mediaPlayer.stop();
            mediaPlayer.release();
            mediaPlayer = null;
                        }
}
Older Posts Home
Subscribe to: Posts (Atom)

Samples List

  • Image Switcher with example
  • Text Switcher Example

Blog Archive

  • ▼  2014 (19)
    • ►  July (13)
    • ►  September (1)
    • ▼  October (5)
      • Build your first android app
      • Text Switcher Example with Swipe
      • android missing contentdescription attribute on image
      • Image Switcher with example and Source code
      • Android: How to Stop Media Player play when Home b...

Translate

Search This Blog

Latest Posts

  • Missing contentDescription attribute on image' in XML
  • How to Show Image View in Center
  • Heghlight Text in text view
  • Android Multi Touch Basics
  • How to check admob overall earning
  • Frame Animation using Image
  • Android Volume Controll
  • android launching default music player
  • Android XML Color Code
  • spinner-dropdown-example
  • Adding Admob Add at the bottom of screen
  • Adding Admob Add at the Top of Screen
  • AddMobAdd

About Me

Unknown
View my complete profile
Copyright © 2014 Successmobigroup Ltd. Simple theme. Powered by Blogger.