Troubles playing sound files using android app development
<p>I am a newbie to Android Development, and I'm having a problem getting my code to implement and actually play a sound file. I suspect that it may due to a problem in my code, however I've looked it over a lot, and I have no idea what could be causing the problem. 
Thanks, Anne</p>

<pre><code>package com.mediaplayer;
import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.R.raw;
public class PlayPlayer extends Activity implements OnTouchListener {

    private MediaPlayer mp;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        final Button button1 = (Button) this.findViewById(android.R.id.button1);
        button1.setOnTouchListener(this);
            mp = MediaPlayer.create(this, R.raw.music);
            mp.start();

    }

    @Override
    public boolean onTouch(View v, MotionEvent event) {

        switch (event.getAction()) {

        case MotionEvent.ACTION_DOWN:
            mp.setLooping(true);
            mp.start();

        case MotionEvent.ACTION_UP:
            mp.pause();
        }

        return true;
    }

}
</code></pre>
