Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7734821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:20:47+00:00 2026-06-01T07:20:47+00:00

I am writing timer application (like the one we use for cooking) for android.

  • 0

I am writing timer application (like the one we use for cooking) for android. I used CountDownTimer to decrease remaining time every second. However, because I am so new at Threads, I didn’t know there was a delay in the timer.

For example, consider simple code using CountDownTimer:

CownDownTimer timer = new CountDownTimer(60 * 1000, 1000) {
     public void onTick(long millisUntilFinished) {
         System.out.println(millisUntilFinished);
     }
}

When I run this, onTick() method should run 60 times, but it doesn’t. Instead, it runs about 57 times. I found out that this is due to delay. What is the most accurate way to write my timer application? Any suggestions? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:20:48+00:00Added an answer on June 1, 2026 at 7:20 am
    CountDownTimer timer = new CountDownTimer(60*1000, 1000) {
        public void onTick(long millisUntilFinished) {
            // TODO Auto-generated method stub
            Log.e("", "millisUntilFinished"+millisUntilFinished);
        }
        @Override
        public void onFinish() {
            // TODO Auto-generated method stub
        }
    };
    timer.start();
    

    I run this code and on logcat i get 59 entries and I think 1 entry not get because when it you stat timer it wait 1000 milies for first also and then go with onTick(),so the code is working fine

    Thanks

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a Java Swing application using the Metal look-and-feel. Every time there is
I'm writing a facebook desktop application for the first time using the PyFacebook api.
I'm writing an app that will need to make use of Timer s, but
I'll spend some time writing some (raw) SQL statements in Android (e.g. for creating
I'm writing a Cocoa application in Objective-C, and I would like to be able
I'm writing an application which has an interval time as a parameter and would
I am writing an application where one of the features is to allow the
I am writing a simple web service using .NET, one method is used to
I've been writing PHP web applications for some time, and have come across very
I am currently writing a simple, timer-based mini app in C# that performs an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.