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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:38:55+00:00 2026-06-06T19:38:55+00:00

I have a 2 part splash screen that I’ve been trying to get to

  • 0

I have a 2 part splash screen that I’ve been trying to get to work on Android 2.2 (eclipse emulator) Everything works in 2.3 emulator. In 2.2 it works more often than not – sometimes goes to black screen – sometimes I need to restart the emulator. If I try to click the screen to cancel the splash and go right to the main activity, it goes to black screen and in the log I see:

06-29 12:23:54.474: I/ActivityManager(58): Starting activity: Intent { cmp=org.test.game/.MainActivity }
06-29 12:23:54.494: W/System.err(278): java.lang.InterruptedException
06-29 12:23:54.504: D/qemud(37): fdhandler_accept_event: accepting on fd 10
06-29 12:23:54.504: D/qemud(37): created client 0x17fe8 listening on fd 15
06-29 12:23:54.504: D/qemud(37): client_fd_receive: attempting registration for service 'sensors'
06-29 12:23:54.504: D/qemud(37): client_fd_receive:    -> received channel id 11
06-29 12:23:54.514: D/qemud(37): client_registration: registration succeeded for client 11
06-29 12:23:54.524: D/qemud(37): fdhandler_accept_event: accepting on fd 10
06-29 12:23:54.524: D/qemud(37): created client 0x18038 listening on fd 16
06-29 12:23:54.524: D/qemud(37): fdhandler_event: disconnect on fd 15
06-29 12:23:54.544: W/System.err(278):  at java.lang.VMThread.sleep(Native Method)
06-29 12:23:54.554: W/System.err(278):  at java.lang.Thread.sleep(Thread.java:1306)
06-29 12:23:54.554: W/System.err(278):  at java.lang.Thread.sleep(Thread.java:1286)
06-29 12:23:54.564: W/System.err(278):  at org.test.game.Splash$SplashScreenDelay.doInBackground(Splash.java:121)
06-29 12:23:54.574: W/System.err(278):  at org.test.game.Splash$SplashScreenDelay.doInBackground(Splash.java:1)
06-29 12:23:54.584: W/System.err(278):  at android.os.AsyncTask$2.call(AsyncTask.java:185)
06-29 12:23:54.594: W/System.err(278):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
06-29 12:23:54.604: W/System.err(278):  at java.util.concurrent.FutureTask.run(FutureTask.java:137)
06-29 12:23:54.604: W/System.err(278):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
06-29 12:23:54.614: W/System.err(278):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
06-29 12:23:54.624: W/System.err(278):  at java.lang.Thread.run(Thread.java:1096)
06-29 12:24:04.475: W/ActivityManager(58): Launch timeout has expired, giving up wake lock!
06-29 12:24:04.484: W/ActivityManager(58): Activity idle timeout for HistoryRecord{44eca1f8 org.test.game/.MainActivity}
06-29 12:24:14.494: W/ActivityManager(58): Activity destroy timeout for HistoryRecord{44ebb9b0 org.test.game/.Splash}

Inspired by http://webgarbage.de/splash-screen-on-android.html

import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MotionEvent;
import android.widget.ImageView;

public class Splash extends Activity {

    private AsyncTask splashDelay;
    private ImageView ivSplash;
    private int splashCount = 0;
    private int splashTime = 2;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splashscreen);
        ivSplash = (ImageView) findViewById(R.id.IVSplash);
        splashDelay = new SplashScreenDelay().execute(splashTime);
    }

    //Touch screen to skip splash
    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
            splashDelay.cancel(true);
        }
        return true;
    }

    private class SplashScreenDelay extends AsyncTask<Integer, Integer, Integer> {

        @Override
        protected Integer doInBackground(Integer... params) {
            try {
                int count = 0;
                while (count < params[0]*10) {
                    if(count % 10 == 0) { 
                        Log.v("Splash", "Sleeping... " + count/10); 
                    }
                    Thread.sleep(100);
                    count++;
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            return new Integer(0);
        }

        @Override
        protected void onPostExecute(Integer result) {
            if (splashCount == 0) {
                splashCount = 1;
                ivSplash.setBackgroundResource(R.drawable.splash2);
                splashDelay = new SplashScreenDelay().execute(splashTime); 
            }
            else 
                startActivity(new Intent(getApplicationContext(), MainActivity.class));
        }

        protected void onCancelled() {
            startActivity(new Intent(getApplicationContext(), MainActivity.class));
        }
    }
}

Any advice? What’s making the cancelling of the splash give a black screen?
I’ve read that “launch timeout has expired” error comes when the MainActivity has to wait too long, but if the splash works interrupted (more time) why should it fail when there is a cancel (less time)?

Thanks

  • 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-06T19:38:58+00:00Added an answer on June 6, 2026 at 7:38 pm

    An async task is not well suited for setting a timer on your splash screen. A more suitable method would be to use a Handler and sendDelayed to delay the splash screen.

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

Sidebar

Related Questions

i have part of Asp.NET 1.1 project. I work with remote site, which works
I am writing an app for android and i am trying to have part
I have part of my script that goes like this: while read line do
I'm stuck on one thing i can't get solved. I have part of code,
I have a part of my app that takes a screenshot of a certain
This is a two part question. I have created a user agreement that the
I have a String in Java. Here is the part of it that I'm
I have a series of text that contains mixed numbers (ie: a whole part
I have an asp.net web application that I made in Visual Studio 2008. Everything
I'm required to have part number that is defined to any character in addition

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.