When the user makes a correct guess, the app displays the correct answer for two seconds before displaying the next flag. To do this, we use a Handler (package android.os
). Handler
method postDelayed receives as arguments a Runnable
to execute and a delay in milliseconds. After the delay has passed, the Handler
’s Runnable
executes in the same thread that created the Handler
. Operations that interact with or modify the GUI must be performed in the GUI thread, because GUI components are not thread safe.