Samuel909 Samuel909 - 1 year ago 200
Android Question

android update textview for every 30 seconds

I want to start a timer from

second and for every 30 seconds,

I need to update the textview as
0.5min, 1.0min, 1.5min

How do I do this?

Answer Source


  final Handler h = new Handler();
   Runnable() {
                public void run() {

                    long millis = (long) currentTime();

                    dateAndTime.setText(getDate(millis, "dd/MM/yyyy hh:mm:ss.SSS"));

                    h.postDelayed(this, 1000);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download