Question : play sound on button click android studio
Answered by : depressed-dugong-j2c45am5kxxe
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 : https://stackoverflow.com/questions/18459122/play-sound-on-button-click-android | Last Update : Thu, 16 Apr 20