Answer the question
In order to leave comments, you need to log in
How to work with time in Java?
I'm a newbie and this problem is confusing me.
By pressing the button, the chronometer starts working, showing how much time has passed since pressing (up to months and years). Initially, I just worked with a variable that increased every second, I realized that it was not an option, because when the application is closed or the phone is rebooted, the time counter is reset. Please help and advice on how to implement this idea
Answer the question
In order to leave comments, you need to log in
Just store the button click date in a database or a file.
For java 8+ use: LocalDateTime
For earlier versions : Date
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question