Four buttons are displayed on the screen. When a button is pressed, the media player plays a sound. The problem I am facing is that it implements setClickable for all buttons at the same time.
After pressing the button, I want all the buttons to be invisible until the media player finishes playing the sound associated with the button click. Then I want all the buttons to be set back to interactive.
The code works fine until I turn on the setClickable code - the code for buttonOne is disabled in my code example below. The test phone is blocked and informs me that the application has stopped and try again.
Unfortunately, without setClickable, the user can press any button and hear a sound before the first selected sound ends.
Thanks for your time and help.
import android.app.Activity; import android.app.AlertDialog; import android.os.Bundle; import android.view.KeyEvent; import android.view.View; import android.widget.ImageButton; import android.media.MediaPlayer; import android.media.MediaPlayer.OnCompletionListener; public class hipsterdoofus extends Activity { private int asoundfilenumber;
android button click clickable
John
source share