In the pass, to build the timer task, for example: to show count down timer on TextView or show current position when play the music or video use MediaPlayer, I use TimerTask or Timer object as the best choices.
This is the old source code
timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {