Christophe Debove
Christophe Debove

Reputation: 6316

FileNotFound Exception MediaPlayer android

I have a1.ogg in the res/raw file

try {
    mp = MediaPlayer.create(this, R.raw.a1);      
} catch (Exception e)
{ Log.e("msg",e.getMessage());  }

Give me java.io.FileNotFoundException

The same file in wav format work

Upvotes: 1

Views: 740

Answers (1)

Preet Sangha
Preet Sangha

Reputation: 65555

Try this:

MediaPlayer mp = new MediaPlayer();

mp.setDataSource("/data/test.ogg"); // replace with correct location
mp.prepare();
mp.start();

Upvotes: 1

Related Questions