'Prevent Android function call from running before its predecessor completes?

I am running a main function that calls three others in succession like this:

public void test() {
   countdown(); 
   secondMethod(); 
   lastMethod(); 
}

But before my call from within countdown() ie intermediateFunction() is compete, secondMethod runs. Countdown contains a timer that calls another function before it completes, like this:

public void countdown() {
    new CountDownTIme(3000, 1000) {
         public void onTick(long millisUntilFinished) {
                text.setText( Long.toString(millisUntilFinished / 1000);
         }
    }
    public void onFinish() {
         text.setText(" "); 
         intermediateFunction(); 
    } 
 }.start(); 
}

How can I get it to run in succession from countdown->intermediate->secondMethod->etc.?



Solution 1:[1]

Call secondMethod() from onFinish() of countdown().

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 CommonsWare