Before doing this exercise, copy all the sound resources to the
assets folder. You may do this by copying all the mp3 files to the
assets folder through the
File Manager, as shown in the following screenshot:
Add code for
btnsound in the
onClick method. Add the following lines so that when the
btnplay button is clicked, it will execute the method named
playSound(). This method will receive a string argument as the value of the sound file name to be played.
soundfile array variable is the variable that stores the list of the mp3 filenames, while the
screennumber indicates the current number on ...