Visually, I\'m expecting my app to show four Toasts in the following order:
public void delayedRandomCue(final long a){
didPlayerRespond = true;
this happens first
createToast("start of delayed RandomCue Method");
randomCue();
Thread delay = new Thread() {
public void run() {
This happens in the background, asynchronously.
try {
createToast("start of delay");
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}finally {
This happens in the background, after asynchronously running and completing
createToast("end of delay");
didPlayerRespond = false;
}
}
};delay.start();
This comes second because it is executed synchronously with the rest of the method.
createToast("end of delayed RandomCue Method");
}