Search Results

Search found 1 results on 1 pages for 'rilcon42'.

Page 1/1 | 1 

  • Android Timer update UI between multiple tasks

    - by Rilcon42
    I have tried multiple ways to have a single persistent timer update the ui in multiple activities, and nothing seems to work. I have tried an AsyncTask, a Handler, and a CountDownTimer. The code below does not execute the first Log.i statement.... Is there a better way to start the timer (which must be called from another class) in Main (which is the only persistent class)? public static void MainLawTimer() { MainActivity.lawTimer = new CountDownTimer(MainActivity.timeLeft, 1000) { public void onTick(long millisUntilFinished) { Log.i("aaa","Timer running. Time left: "+MainActivity.timeLeft); MainActivity.timeLeft--; if(MainActivity.timeLeft<=0) { //do stuff } else { //call method in another class } }

    Read the article

1