how to play a sound on click of button
<p>i am trying to play sound file on the emulator on click of button but i am getting message "application play audio has stopped unexpectedly"</p>

<p>my codes are:</p>

<pre><code>package com.java4u.android;

import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public  class p1 extends Activity {


// creating instance of media player
MediaPlayer mp=MediaPlayer.create(this,R.raw.meow);
@Override
protected void onCreate(Bundle savedInstanceState) 
{    
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Button btnSound=(Button)this.findViewById(R.id.playSound);

    btnSound.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
        startActivity(new Intent("com.java4u.android.p1")); 
            mp.start();
        }
    }); 

        }

}
</code></pre>

<hr>

<p>Manifest.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.java4u.android"
      android:versionCode="1"
      android:versionName="1.0"&gt;
    &lt;uses-sdk android:minSdkVersion="8" /&gt;

    &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
        &lt;activity android:name=".p1" android:label="@string/app_name"&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;
                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;

    &lt;/application&gt;
&lt;/manifest&gt;
</code></pre>

<p>main.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;

&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    &gt;
    &lt;Button android:text="play audio" 
    android:id="@+id/playSound" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"&gt;
    &lt;/Button&gt;
&lt;/LinearLayout&gt;
</code></pre>
