Can't access the audio file with MediaPlayer Class in android app
<p>I had import the audio file from the computer to the emulator with the help of file manager in DDMS. Then I make a MediaPlayer class and with the help of two buttons, I am starting and stopping the song and a textview which show the status of playing and stopping.</p>

<p>But when i press the button song doesn't play but the status is being changing and I got an error in LogCat as follow...</p>

<pre><code>prepareAsync called in state 1
</code></pre>

<p>and when I stop </p>

<pre><code>Stop called in state 1
error(-38,0)
</code></pre>

<p>The code is.`</p>

<pre><code>public class main extends Activity implements OnClickListener {
MediaPlayer mp = null;
TextView status = null;
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mp = new MediaPlayer();
    Button start = (Button) findViewById(R.id.button1);
    Button stop = (Button) findViewById(R.id.button2);
    status = (TextView)findViewById(R.id.textView1);
    start.setOnClickListener(this);
    stop.setOnClickListener(this);

    try {
        if(checkFileExists("qq.mp3")) {
            if(getExternalStorageDirectory()!=null) {
                mp.setDataSource(getExternalStorageDirectory()+"/"+"fast.mp3");
                //mp.setDataSource("http://www.testprojects.in/babylaugh.mp3");
            }

        }

    } catch (Exception e) {
        e.printStackTrace();
    }

}

public boolean isExternalDrivePresent() {
    boolean status = false;
    String state = Environment.getExternalStorageState();

    if (Environment.MEDIA_MOUNTED.equals(state)) {
        status = true;
    }

    return status;
}

public String getExternalStorageDirectory() {

    String path = null; 

    if(isExternalDrivePresent()) {
        path = Environment.getExternalStorageDirectory().getPath();
    }   
    return path;
}

public boolean checkFileExists(String fileName) {
    boolean status = false;
    String directoryPath = getExternalStorageDirectory(); 
    if(directoryPath != null) {
        File file = new File(directoryPath+"/"+fileName);
        if(file.exists()) {
            status = true;
        }
    }
    return status;
}

public void onClick(View v) {

    if(v.getId()==R.id.button1) {
        try {
            mp.prepare();
            mp.start();
        }catch(Exception e) {
            e.printStackTrace();
        }
        status.setText("Playing...");
    }else {
        mp.stop();
        status.setText("Stopped...");
    }
}
</code></pre>

<p>}`</p>

<p>Why the song doesn't play..??</p>
