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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:30:11+00:00 2026-05-28T03:30:11+00:00

i am designing a app for some quiz. i need an activity that starts

  • 0

i am designing a app for some quiz.
i need an activity that starts when i press the start button waits for 1 sec displays a red image,watis for 1 sec again displays a yellow face and waits for another sec and displays a green image.

The activity that starts when start quiz is pressed.

public class pgtwo extends Activity {

ImageView rface,yface,gface;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    setContentView(R.layout.newpg2);            


    rface = (ImageView) findViewById(R.id.imageView1);
    yface = (ImageView) findViewById(R.id.imageView2);
    gface = (ImageView) findViewById(R.id.imageView3);
    rface.setVisibility(ImageView.INVISIBLE);
    yface.setVisibility(ImageView.INVISIBLE);
    gface.setVisibility(ImageView.INVISIBLE);



           Thread trd = new Thread(){           
        @Override
        public void run() {
            // TODO Auto-generated method stub
            try {
                sleep(1000);
                rface.setVisibility(ImageView.VISIBLE);
                sleep(1000);
                yface.setVisibility(ImageView.VISIBLE);
                sleep(1000);
                gface.setVisibility(ImageView.VISIBLE);

            } catch (Exception e) {
                // TODO: handle exception
            }finally{
                Intent myIntent = new Intent("com.ak.qmttpack.pgthree");
                myIntent.putExtra("pname", pname);
                myIntent.putExtra("tabList", tabList);
                myIntent.putExtra("order",order);
                myIntent.putExtra("noq", noq);
                myIntent.putExtra("seq", seq);
                startActivity(myIntent);
            }
        }
    };
    trd.start();


}

}

i set the images visability as invisable and after waiting for 1 second each image visability becomes visable.
it waits for few seconds and starts the next activity.it dosent work as expected to. why any help plese.
or is there another way to get what i need.

  • 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-05-28T03:30:12+00:00Added an answer on May 28, 2026 at 3:30 am

    You cannot modify the UI from your thread, and you are getting an Exception that you just ignore (which is very bad practice). To modify the UI from another thread you should either create a Handler inside the onCreate() method and then :

      handler.post(new Runnable() {
            @Override
            public void run() {
                      rface.setVisibility(View.Visible);        
            }
        });
    

    or use runOnUiThread() from you thread.

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

Sidebar

Related Questions

I am designing an app that will have some activities separated in tabs. Some
I am designing a web app that has some information that needs to be
I'm creating a Trivia app, and need some help designing my model relationships. This
I'm currently designing an app that calls for dynamically creating objects and then displaying
I am designing an app which will present large amounts of text that is
I'm currently designing an app that pulls map data from a service and renders
I'm designing a CUDA app to process some video. The algorithm I'm using calls
I'm designing some web app, I went for some _layout.cshtml, which fragment: //some html
I'm designing an iPad app that will have a custom grid in it. The
I am currently designing an iOS 5 iPhone app that will use a .NET

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.