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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:53:50+00:00 2026-06-14T09:53:50+00:00

When I run this, It is supposed to draw the ui, (two simple images

  • 0

When I run this, It is supposed to draw the ui, (two simple images and a text static text field) wait five seconds, then advance to the next activity (another page with a few buttons)

I can get it to load the images and not advance, OR to show a blank page, wait five, then go forward.

The main java doc:

package com.example.ccbc_maps;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;

public class MainActivity extends Activity 
{

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //When I add a call to the main function here it just displays the white space
        //Then advances after five seconds same thing if I paste the code within
        //The main method.
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) 
    {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
     }

    public void main()
    {
        try 
        {
            Thread.sleep(5000);
        } 
        catch (InterruptedException e) 
        {

        }

        Intent goForward = new Intent(this, CampusSelect.class);
        startActivity(goForward);
    }
}

And this is the class it advances to:

package com.example.ccbc_maps;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class CampusSelect extends Activity 
{

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_campus_select);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) 
    {
        getMenuInflater().inflate(R.menu.activity_campus_select, menu);
        return true;
    }
}

Thanks for the help!

  • 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-14T09:53:52+00:00Added an answer on June 14, 2026 at 9:53 am

    Things are not working as you expect because you’re forcing the main thread (UI thread) to sleep.

    When you modify the UI, like call setContentView() or modify the properties of your Views, they do not happen immediately. Instead, they get put in a message queue to be executed by the main thread later.

    You need to actually do the waiting in a separate thread. Probably the simplest way to accomplish what you’re trying to do is to use Handler.postDelayed() to schedule some work to be done on the main thread at a later time.

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.R.layout.activity_main);
    
        new Handler().postDelayed(new Runnable()
        {
            @Override
            public void run()
            {
                Intent goForward = new Intent(MainActivity.this, CampusSelect.class);
                startActivity(goForward);
            }
        }, 5000);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I run this simple program on Windows 7 and then on AIX (Unix
I run this code here <html> <script type=text/javascript src=lib/jquery-ui-1.8.21.custom.min.js></script> <script src=http://127.0.0.1:5984/_utils/script/jquery.couch.js></script> <!--<script type=text/javascript src=lib/jquery-1.7.2.js></script>-->
I'm going to run this really simple cod that will be compiled in visual
This is a program I'm writing that's supposed to display some text in a
Isn't this supposed to produce a segfault? When I run the code the output
I give up now on this very simple test I've been trying to run.
Simple question. When I run this image through pytesser, i get $+s . How
I'm trying to run this code that was supposed to be a cut and
According to Google Analytic's documentation on social tracking , I'm supposed to run this
I run this code: - (void)unitButtonButtonTapped:(id)sender { [_label setString:@Last button: Unembossed square]; MilitaryUnits *target

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.