title: Not able to check Android Service Issue
body: <p>All I want to do is simply control background music in my app through a service so I am able to start it and stop it from any activity.</p>
  
  <p>I have everything set up perfectly when I tell the service to Toast when it is started and destroyed but as soon as I put the media play-in in there instead It starts fine and starts playing the music but as soon as a click a button to stop the service I get an error and a force close.</p>
  
  <p>Can anyone suggest what I am doing wrong? </p>
  
  <p><strong>Here is my code:</strong></p>
  
  <pre><code>import android.app.Service;
  import android.content.Intent;
  import android.media.MediaPlayer;
  import android.os.IBinder;
  import android.widget.Toast;
  
  public class MyService extends Service {
  
  private MediaPlayer player;
  
  @Override    
  public IBinder onBind(Intent intent) {
  returnnull;
  }
  
  @Override    
  publicvoid onCreate() { 
  super.onCreate(); 
  Toast.makeText(this, "Service Started", Toast.LENGTH_SHORT).show();
  MediaPlayer player = MediaPlayer.create(MyService.this, R.raw.oceanwavestest);
  player.start();
  player.setLooping(true);
  
  }
  
     @Override    
     publicvoid onDestroy() {
     super.onDestroy();
     player.stop();
     Toast.makeText(this, "Service Stopped", Toast.LENGTH_SHORT).show();
     } 
  } 
  </code></pre>