java - Basic time elapse coding on android -


i want calculate time in seconds once activity had started, kind of library or function should use? minimal coding can that?

you can this:

int cnt = 1; while(condition) {     //print cnt     thread.sleep(1000); // wait 1 second     cnt++;    //... } 

but have take care, every command add in the do-while loop take time, too.

another opportunity use timer. don't have experience that, maybe helps you: print “hello world” every x seconds


Comments