play sound on button click android studio

Solutions on MaxInterview for play sound on button click android studio by the best coders in the world

showing results for - "play sound on button click android studio"
Paula
17 Jan 2018
1Button one = (Button) this.findViewById(R.id.button1);
2final MediaPlayer mp = MediaPlayer.create(this, R.raw.soho);
3one.setOnClickListener(new OnClickListener(){
4
5    public void onClick(View v) {
6        mp.start();
7    }
8});
Hubert
23 Sep 2016
1public class MainActivity extends AppCompatActivity{
2	Button bt;
3	
4	@Override
5	protected void onCreate(Bundle savedInstanceState){
6		super.onCreate(savedInstanceState);
7		setContentView(R.layout.activity_main);
8		bt = (Button)findViewById(R.id.clickme);
9		final MediaPlayer mp = MediaPlayer.create(this, R.raw.sample);
10		bt.setOnClickListener(new View.OnClickListener(){
11			@Overridepublic void onClick(View view){
12				np.start();
13			}
14		}
15	}
16}
queries leading to this page
android java button to play soundandroid studio sound buttonandroid studio how to change xound on button clickplay music on button click android studioandroid studio plaz soundhow to make a view make a sound when clicked androidppay sound on button click androidandroid studio play soundplay audio on click androidplay difrent sound with one button android studioplay music imagebutton android java codebutton tap to play custom sound in javaonclick produce sound android studiohow to plat a sound in androidkotlin setonclicklistener button plays different soundsandroid play sound on button click examplehow to add sound to a button in android studioplay sound onclick android studiobutton sound in android studioandroid studio how to play soundandroid studio play sound on button clickhow to play a sound in android studiosound android studioandroid studio change sound on button clickandroid studio sound on clickbutton click sound androidandroid play sound effect onclickandroid studio button play soundandroid studio how to change audio on button clickhow to add an sound to a button in android studiosound in android studiosong play button click in androidhow to play music on button click in android studiohow to play sound on image click in android android studio play sound filehow to play a sound from each button click android studioplay sound on button click androidplay sound in android studiohow to play sounds android studioplay music using on button click androidandroid studio play sound when click buttonhow to play sound on android studioandroid java button on click play soundhow to play sound with button click android studiomake an android app play sound on button clickandroid play music on button clickandroid play sound on clickhow to add sound in android programmaticallyplay sound on click android studioplay sound on button click android studiobutton to play sound android studio downloadplay a sound android studiohow to add sound on button click in android studiohow to play sound android studioandroid button plays sound javaplay sound with button click kotlinhow to play sound when user click on button in android studioplay sound on image click androidadd on click sound on android studiosandroid play sound on button clickplay sound on image button click android studioplay sound android studioandroid studio next sound on button clickandroid studio play sound on button click kotlinhow to play a sound in java in android studioclick sound function android studioandroid studio button play sound downloadandroid studio button play sound kotlinplay music on android activityplay sound androidandroid app play sound on button clickkotlin android button play soundandroid studio public void play soundplay button in media player android studio roundandroid button play sound javasound button android studioandroid how to play mp3 sound file when button pressedplay button musicandroid java play soundandroid studio play sound on clickplay sound in androidadd sound button to android studiomake onclick make sound in android studioplay sound on button click android studio