Android - To measure the time between the two button clicks

后端 未结 3 1479
南旧
南旧 2021-01-01 18:08

I have a button named Check In. My aim is on click to change the text and start counting the time. The timer has to stop at the next click. It should give the t

3条回答
  •  星月不相逢
    2021-01-01 18:32

    You can use System.currentTimeMillis() (or create a new Date or GregorianCalendar instance) on click.

    Save it somewhere. On next click do the same. Then compare the times.

提交回复
热议问题