如何在Android中暂停/休眠线程或进程?
thisbutton.setBackgroundResource(R.drawable.icon);
thisbutton.setBackgroundResource(R.drawable.defaultcard);
try { Thread.sleep(1000);} catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace();}
new Reminder(5);
public class Reminder {Timer timer; public Reminder(int seconds) { timer = new Timer(); timer.schedule(new RemindTask(), seconds*1000); } class RemindTask extends TimerTask { public void run() { System.out.format("Time's up!%n"); timer.cancel(); //Terminate the timer thread } } }
繁星coding
相关分类