I'm currently having a problem when a button is pressed before the activity is fully displayed. My app is a questionnaire type that spawns buttons as options for the question. If I press the button repeatedly and fast, a black screen will randomly occur but the activity will still display afterwards.

My current solution is to put a delay before I set the event listener to the buttons.

private Runnable task = new Runnable() {
        public void run() {

And put this in onCreate or onPostCreate

Handler handler = new Handler();
        handler.postDelayed(task, 500);

0 Answers