You can access the current time:
long time = System.currentTimeMillis();
After that, you can get the second part:
int seconds = new Date(time).getSeconds();
Then you can subtract this from 60 and get sleep time.
int sleepSecs = 60 - seconds;
Then set to disable handler.postDelayed()
handler.postDelayed(drawRunner, sleepSecs*1000);
After the first use, you can use a constant 60,000 milliseconds of lull.
Note that getSeconds () can return 60 or 61 as the second value! Documentation
source share