Answers for "how to play sound in android studio"

0

play sound android studio kotlin

//make a audio file in the res/raw directory
mediaPlayer = MediaPlayer.create(this, R.raw.FILE_NAME)
mediaPlayer?.start()
Posted by: Guest on April-18-2020
1

play sound on button click android studio

Button one = (Button) this.findViewById(R.id.button1);
final MediaPlayer mp = MediaPlayer.create(this, R.raw.soho);
one.setOnClickListener(new OnClickListener(){

    public void onClick(View v) {
        mp.start();
    }
});
Posted by: Guest on April-09-2020

Code answers related to "how to play sound in android studio"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language