用Handle做定时器,显示时间,实现详见代码:
...
mTimeTv = new TextView(this);
SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");
String date = df.format(new java.util.Date());
mTimeTv.setText(date);
mTimeTv.setTextSize(35);
mTimeTv.setTextColor(Color.BLACK);
timeHandler.postDelayed(updateTimeThread, 1000);
}
Handler timeHandler = new Handler();
Runnable updateTimeThread = new Runnable() {
public void run() {