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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:33:37+00:00 2026-06-16T13:33:37+00:00

During loading of my android application i want to show a logo during the

  • 0

During loading of my android application i want to show a logo during the first 2,3 seconds of launching, I think it’s less ugly than just seeing a UI after launching.
So in my code i make first a setContentView with the logo (splash) and after a setContentView with the UI (main).
The pb is instead of seeing the logo screen I just see a black screen.
I am doing that in main thread so I don’t understand.
Do you have an explanation of the problem and if possible a workaround ?

The not working well onCreate() of the activity is the following (black screen during 5 seconds and after can see the UI, no exception thrown) :

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash); //doesn't work
    Log.i(TAG, Thread.currentThread().getName());
    //this.r
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        Log.i(TAG, Thread.currentThread().getName() + e.toString() );
    }
    setContentView(R.layout.main); //work OK
}

}

if I just left the class with the code below there is no problem I can see the “first” and only view :

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash); //work OK

}
}

  • 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-16T13:33:39+00:00Added an answer on June 16, 2026 at 1:33 pm

    You can use TimerTask instead of using Thread.sleep for making wait in main UI thread as:

    new Timer().schedule(new TimerTask() {
        @Override
        public void run() {
            // use runOnUiThread for Updating Ui elements
            Your_Activity.this.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                     // set Activity Next layout Here
                    setContentView(R.layout.main);
                }
            });
        }
    }, 5000);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to show an images gallery . The problem is during the loading
In my android application an activity takes more than 10 seconds to load (it
I want to add a non-native shared library to Android so every application on
When I launch my game I want the screen to show a loading image
For some reason during loading one of the scenes in my game, the background
Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException:
I've got a few loading bars that appear during any postbacks. How can I
During the installation of my app, I want to create a PostgreSQL-Database and some
During our efforts to design InApp Billing for our Android App, we came up
During the work on my iPhone application the icon changed from time to time.

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.