+ private Handler mHandler = new Handler();
+
+ private Runnable updateClock = new Runnable () {
+ public void run() {
+ long now = System.currentTimeMillis();
+ Time tm = new Time();
+ tm.set(now);
+ tvt.setText(tm.format("%H:%M"));
+ tm.set(now + 60000);
+ tm.second=0;
+ long next = tm.toMillis(false);
+ mHandler.postDelayed(this, next-now+1);
+ }
+ };
+
+ private Runnable updateCal = new Runnable () {
+ public void run() {
+ long now = System.currentTimeMillis();
+ Time tm = new Time();
+ tm.set(now);
+ tvd.setText(
+ wday[tm.weekDay] +
+ tm.format("\n%d ") +
+ month[tm.month] +
+ tm.format(" %Y"));
+ tm.set(now + 86400000);
+ tm.hour=0;
+ tm.minute=0;
+ tm.second=0;
+ long next = tm.toMillis(false);
+ mHandler.postDelayed(this, next-now+1);
+ }
+ };
+
+ private Runnable updateInfo = new Runnable () {
+ public void run() {
+ Log.v("updateInfo", "starting");
+ for (int i = 0; i < ut.length; i++) {
+ ut[i].tv.setText(R.string.updating);
+ new TimedUpdateTask().execute(ut[i]);
+ }
+ mHandler.postDelayed(this, 10000);
+ }
+ };
+
+ private class TimedUpdateTask extends AsyncTask<UpdateTarget, Void, String> {
+ private UpdateTarget ut;