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

  • SEARCH
  • Home
  • 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 8723689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:41:06+00:00 2026-06-13T07:41:06+00:00

I am new to android. I have an application which needs to show a

  • 0

I am new to android. I have an application which needs to show a data stored in database (which is a time value, example 40 hours) in a textview.

I want to count down the value from 40 (in my case) to zero and an alarm should start when it hits zero.

need to show countdown like image

  • 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-13T07:41:07+00:00Added an answer on June 13, 2026 at 7:41 am

    just convert remaining time in second(get hour value from db and convert it into second, in my case i am getting time in seconds )

    public class CountDownActivity extends Activity {
    
        int time,initStart,startPointTime,hh,mm,ss,millis;
        TextView txtSecond;
        TextView txtMinute;
        TextView txtHour;
        TextView txtDay;
        Handler handler;
        long seconds =40*60*60;
        Runnable updater;
    
            @Override
            protected void onCreate(Bundle savedInstanceState) {
                // TODO Auto-generated method stub
                super.onCreate(savedInstanceState);
    
    
        txtSecond=(TextView)findViewById(R.id.cntSecond);
                txtMinute=(TextView)findViewById(R.id.cntMinute);
                txtHour=(TextView)findViewById(R.id.cntHour);
                txtDay=(TextView)findViewById(R.id.cntDay);
    
                        handler= new Handler();
                initStart = (int) SystemClock.elapsedRealtime();
    
                 updater = new Runnable() {
    
                    public void run() {
                        int sec,minute,hour,day;
                        long  diff = seconds;
                        System.out.println(diff);
                        if (diff >= 1) {
                            sec =  (int) (diff%60);
                        } else {
                            sec=00;
                        }
                        txtSecond.setText("" +sec);
                        diff = diff/60;
                        System.out.println(diff);
                        if (diff >= 1) {
                            minute =  (int) (diff%60);
                        } else {
                            minute=00;
                        }
                        txtMinute.setText("" +minute);
                        diff = diff/60;
                        if (diff >= 1) {
                            hour =  (int) (diff%24);
                        } else {hour = 00; }
                        txtHour.setText("" +hour);
                        diff = diff/24;
                        if (diff >= 1) {
                            day =  (int) diff;
                        } else { day =00; }
                        txtDay.setText("" +day);
                        seconds=seconds-1;
    
    
                        handler.postDelayed(this, 1000);
                    }
                };
    
                handler.post(updater);
    }
    
    > //and don't forget to removeCallback on destroy
    
        @Override
        protected void onDestroy() {
            // TODO Auto-generated method stub
            super.onDestroy();
            handler.removeCallbacks(updater);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Android application which needs username and password to login. I need
In my Android application I have an Observable Data class, which contains a method
i am creating a new android application.i am using the table layout. I have
I am new to Android. I have tried an sample application for status bar
I am new to phonegap and android, I have create a hello world application
I need an Android application which should be able to fetch data from the
I am new in Android application development, but I have programming knowledge in iOS.
I have Android application which is Sales Rep application.When he using the app first
I have a problem with my android application. I need to show all files
I've got an Android application which needs to be woken up sporadically throughout the

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.