I would like to press a button, where it will change the color of a button and play a sound, then wait time (t) then change the color of the button again.
button1.setOnClickListener(new View.OnClickListener(){
@Override
public void OnClick(View v) {
button1.setImageResource(R.drawable.yellow_block); /* Changes Color */
sp.play(sound,1,1,0,0,1); /*Plays sound*/
//Wait t amount of time here
button1.setImageResource(R.drawable.green_block); /* Changes Color Again */
You can use
postDelayed()method like thisIf you want to stop music too, you might need to change my code a bit.