Samuel909 Samuel909 - 4 months ago 55
Android Question

android update textview for every 30 seconds

I want to start a timer from

0th
second and for every 30 seconds,

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

How do I do this?

Answer

update

  final Handler h = new Handler();
            h.post(new Runnable() {
                @Override
                public void run() {

                    long millis = (long) currentTime();

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

                    h.postDelayed(this, 1000);
                }
            });
Comments