title: unable to destroy activity IllegalStateException
body: <p>I have created a media player in android where the MediaPlayer is on a service.
  my main activity has an option menu with single item "exit" onOptionsItemSelected calls another method (mp is and instance of MediaPlayer in service)</p>
  
  <pre><code>private void exitPlayer() {
          PlayerService.mp.stop();
          onDestroy();
      }
  </code></pre>
  
  <p>and onDestroy method is simple </p>
  
  <pre><code>protected void onDestroy() {
          super.onDestroy();
          if (!PlayerService.mp.isPlaying()) {
              stopService(playerService);
              cancelNotification();
              finish();
          }   
      }
  </code></pre>
  
  <p>but it throws </p>
  
  <blockquote>
    <p>java.lang.RuntimeException: Unable to destroy activity 
    java.lang.IllegalStateException</p>
  </blockquote>
  
  <p>can any one help me? thanks</p>