title: Android onPause() causing Activity to crash
body: <p>for some reason my Activity crash when I finish that specified activity. Before when I have only the onDestroy everything works fine except when i minimize the application (HOME button), the music still plays.</p>
  
  <p>From what I gathered, I end up using <code>onDestroy()</code>, <code>onResume()</code> and <code>onPause()</code> to manipulate the <code>MediaPlayer</code>... but for some reason, when the activity finished, An Alert Dialog stating that <code>Unforunately, ProgramX has stopped.</code> ALTHOUGH, it continues on to the next startActivity(intent) like it should.</p>
  
  <pre><code>MediaPlayerAssets gls; // custom MediaPlayer Assets to fetch MediaPlayer objects
  @Override 
  protected void onPause()
  {
      super.onPause();
      gls.glbgm.pause(); // my logCat demands that the error occurs here.
      resumeToPosition = gls.glbgm.getCurrentPosition();
  }
  
  
  @Override
  protected void onRestart()
  {
      super.onRestart();
      if(gls.glbgm != null &amp;&amp; !gls.glbgm.isPlaying())
      {
          gls.glbgm.seekTo(resumeToPosition);
          gls.glbgm.start();
      }
  }
  
  @Override
  protected void onDestroy() {
      super.onDestroy();
      gls.glbgm.release();
      gls.score.release();
      gls.loser.release();
  }
  </code></pre>
  
  <p><li>E/AndroidRuntime(23422): FATAL EXCEPTION: main
  <li>E/AndroidRuntime(23422): java.lang.RuntimeException: Unable to pause activity
  {com.fenrirAB.request/getluckyPkg.GetLuckyGame}: java.lang.IllegalStateException
      <li>E/AndroidRuntime(23422):    at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3112)
      <li>E/AndroidRuntime(23422):    at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3067)
      <li>E/AndroidRuntime(23422):    at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3045)
      <li>E/AndroidRuntime(23422):    at android.app.ActivityThread.access$900(ActivityThread.java:152)
  <li>E/AndroidRuntime(23422):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1295)
  <li>E/AndroidRuntime(23422):    at android.os.Handler.dispatchMessage(Handler.java:99)
  <li>E/AndroidRuntime(23422):    at android.os.Looper.loop(Looper.java:137)
  <li>E/AndroidRuntime(23422):    at android.app.ActivityThread.main(ActivityThread.java:5299)
  <li>E/AndroidRuntime(23422):    at java.lang.reflect.Method.invokeNative(Native Method)
  <li>E/AndroidRuntime(23422):    at java.lang.reflect.Method.invoke(Method.java:511)
  <li>E/AndroidRuntime(23422):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
  <li>E/AndroidRuntime(23422):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
  <li>E/AndroidRuntime(23422):    at dalvik.system.NativeStart.main(Native Method)
  <li>E/AndroidRuntime(23422): Caused by: java.lang.IllegalStateException
  <li>E/AndroidRuntime(23422):    at android.media.MediaPlayer._pause(Native Method)
  <li>E/AndroidRuntime(23422):    at android.media.MediaPlayer.pause(MediaPlayer.java:1372)
  <li>E/AndroidRuntime(23422):    at getluckyPkg.GetLuckyGame.onPause(GetLuckyGame.java:357)
  <li>E/AndroidRuntime(23422):    at android.app.Activity.performPause(Activity.java:5447)
  <li>E/AndroidRuntime(23422):    at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1243)
  <li>E/AndroidRuntime(23422):    at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3098)
  <li>E/AndroidRuntime(23422):    ... 12 more
       </p>