Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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();
    }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #play #sound #button #click #android #studio
ADD COMMENT
Topic
Name
2+6 =