All of the other code is just part of a tutorial I was learning. I've just built off the tutorial that I was learning and started learning by myself through trial and error. Also I have a problem when using the else statement. It always tells me to delete it after I've added it. I just removed it from the code until someone can tell me how to fix this and hopefully teach me how to use the else statement.

@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); playPauseButton = (Button)findViewById(R.id.PlayPauseButton); mp = MediaPlayer.create(this, R.raw.soundToPlay); //soundToPlay is the name of the sound file to be played. this can be anything as long as it follows the conventions of eclipse and the android SDK. mp.prepare(); playPauseButton.setOnClickListener( new OnClickListener() { public void onClick(View v) { if(!playing) { mp.start(); playing = true; } else { mp.pause(); playing = false; } } }); }