java android play sound file with variable

Solutions on MaxInterview for java android play sound file with variable by the best coders in the world

showing results for - "java android play sound file with variable"
Luciano
08 Mar 2016
1private void playMp3(String nameOfFile){
2   MediaPlayer mPlayer = MediaPlayer.create(this, getResources().getIdentifier(nameOfFile, "raw", getPackageName()));
3   mPlayer.start();
4}