Addig a file to MediaPlayer is easy:
mp = MediaPlayer.create(Myctivity.this, R.raw.sound);
But what if I have the filename as an argument coming from a function like this?
public void CreateSound(String filename, float volume)
{
mp = MediaPlayer.create(Myctivity.this, R.raw.???);
mp.setVolume(volume, volume);
try {
mp.prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mp.start();
}