1

i want TimerTask pause and resume

view story
linux-howto

http://stackoverflow.com – i am working in a game so i have need to use time which update in every second.i am using TimerTask.I want to pause time When i clicked on a button and want to resume it again when i clicked on resume button from other activity.How to do it please help me. t=new Timer(); { t.scheduleAtFixedRate(new TimerTask() { public void run() { runOnUiThread(new Runnable() { @Override public void run() { TextView tv = (TextView) findViewById(R.id.time); tv.setText(String.format("%02d:%02d",minute,seconds)); time += 1; seconds += 1; if(seconds==60) { seconds=0; } minute=time/60; } } (HowTos)