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 8151175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:17:29+00:00 2026-06-06T15:17:29+00:00

my application is question/answer application , the user ask for a question , then

  • 0

my application is question/answer application , the user ask for a question , then the server send question to a user, when user receives the question , a ShowQuestion button appears , when user click it , i want to start timer , because a user have to answer in just 36 Second
i build a textView in my xml like this

<TextView
        android:id="@+id/tvRemaingTime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="visible" 
/>

and in my Java activity i make this

TextView remaingTimer;
CountDownTimer timer;
private void initialize() {
remaingTimer=(TextView)findViewById(R.id.tvRemaingTime);
}

and when a user click ShowQuestion i make this

timer =new CountDownTimer(360000,100) {
   public void onTick(long millisUntilFinished) {
        remaingTimer.setText(millisUntilFinished+"");
   }
   public void onFinish() {
    remaingTimer.setText("finish");
   }
};
timer.start();

but it doesn’t print anything, what am i doing wrong ?

NOTE

i am using AsyncTask to get question from server like this:

public class getQuestionFromServer extends
    AsyncTask<String, Integer, String[]> {}

but i don’t thing it effect on textView because the ShowQuestion button will not appear else a user have got a question from the server

  • 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-06T15:17:32+00:00Added an answer on June 6, 2026 at 3:17 pm

    you can use runOnUiThread for updateing TextView from Thread as:

    TextView remaingTimer;
    CountDownTimer timer;
    private boolean mClockRunning=false;
    private int millisUntilFinished=36;
    private void initialize() {
    remaingTimer=(TextView)findViewById(R.id.tvRemaingTime);
    }
     ShowQuestionbutn.setOnClickListener(new OnClickListener() {    
                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    if(mClockRunning==false)
                    {
                        mClockRunning=true;
                        millisUntilFinished=0;
                        myThread();
                    }
        public void myThread(){
                Thread th=new Thread(){
    
                 @Override
                 public void run(){
                  try
                  {
    
                   while(mClockRunning)
                   {
                   Thread.sleep(100L);// set time here for refresh time in textview
                   CountDownTimerActivity.this.runOnUiThread(new Runnable() {
    
                    @Override
                    public void run() {
                     // TODO Auto-generated method stub
                         if(mClockRunning)
                         {
                                                                                                           if(millisUntilFinished<0)
                   {
                   mClockRunning=false;
                   millisUntilFinished=36;
                    }
                    else
                    {
                   millisUntilFinished--;
                   remaingTimer.setText(millisUntilFinished+"");//update textview here
                   }
                         }
    
                };
                           }
                  }catch (InterruptedException e) {
                // TODO: handle exception
                 }
                 }
                };
                th.start();
               }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm designing a question-and-answer Ruby on Rails application. After a user logs in, you
I'm trying to develop an application question forum, where user can submit their answer
Hi i am developing an application in MVC using nhibibernate. It is an Question-Answer
I did not find an answer to this question. I have a VOIP application.
I am developing a simple support application where clients ask questions and admins answer
I'm developing a question/answer based application I have a Post table in the db
I am developing one application. Suppose user save question with 4 option and one
I am creating a web application that asks user for randomized security question. However,
i am new to android programming.i looking to make a question and answer application.in
I have a Yesod application (but question is more general than this) that allows

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.