Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java android play sound file with variable

private void playMp3(String nameOfFile){
   MediaPlayer mPlayer = MediaPlayer.create(this, getResources().getIdentifier(nameOfFile, "raw", getPackageName()));
   mPlayer.start();
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #android #play #sound #file #variable
ADD COMMENT
Topic
Name
9+5 =