- long millis = System.currentTimeMillis();
- Log.v("updateClock", "executing");
- // new TimedUpdateTask().execute(5); // for delayed execution
- tv.setText(Long.toString(millis));
- mHandler.postDelayed(this, 2000);
+ 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");
+ tv.setText(R.string.updating);
+ new TimedUpdateTask().execute(5); // for delayed execution
+ mHandler.postDelayed(this, 10000);