Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private class ShowTiming extends TimerTask {
- public final void run() {
- sec--;
- updateFromTimer(sec);
- }
- protected void updateFromTimer( int remainingTimeSeconds ) {
- if (remainingTimeSeconds > 0) {
- questionForm.setTitle( category + " Questions " + formatTime ( remainingTimeSeconds ) );
- } else {
- showMark();
- }
- }
- String formatTime( int timeInSeconds ) {
- int hr = timeInSeconds/3600;
- int min = (timeInSeconds - (hr*3600))/60;
- int sec = timeInSeconds - ((hr*3600)+ ( min*60));
- String hrs="",mins="",secs="";
- if ( hr < 10 )
- hrs = "" + Integer.toString ( hr );
- else
- hrs = Integer.toString ( hr );
- if ( min < 10 )
- mins = "0" + Integer.toString ( min );
- else
- mins = Integer.toString ( min );
- if ( sec < 10 )
- secs = "0" + Integer.toString ( sec );
- else
- secs = Integer.toString ( sec );
- return ""+ hrs +":" +mins+ ":" + secs;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement