title: MediaPlayer doesn't work after onPause and onResume
body: <p>I'm developing an Android 2.2 application.</p>
  
  <p>I have the following Activity:</p>
  
  <pre><code>public class StartActivity extends Activity {
  
      private MediaPlayer mp;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.startpage);
      }
  
      @Override
      protected void onResume() {
          super.onResume();
          ImageView ship = (ImageView)findViewById(R.id.greekShip);
  
          ship.startAnimation(AnimationUtils.loadAnimation(this, R.anim.translate_right));
  
          if (mp == null) {
              mp = MediaPlayer.create(getApplicationContext(), R.raw.oceanwave);
          }
          else {
              if (mp.isPlaying())
                  mp.stop();
              mp.reset();
              try {
                  mp.prepare();
              } catch (IllegalStateException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
          }
          mp.start();
      }
  
      @Override
      protected void onPause() {
          super.onPause();
  
          if (mp != null) {
              if (mp.isPlaying())
                  mp.stop();
          }
      }
  }
  </code></pre>
  
  <p>If I press home button on my telephone, the sound stops. But if I restart the app, the mediaplayer starts but I can't hear anything.</p>
  
  <p>Do you know where is the problem?</p>