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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:21:22+00:00 2026-05-17T19:21:22+00:00

I have a splash screen that implements MainScreen, and I am trying to use

  • 0

I have a splash screen that implements MainScreen, and I am trying to use Timer to wait 3 seconds to push a new screen.

TimerTask splashTask = new TimerTask() {
    public void run() {
        UiApplication.getUiApplication().pushScreen(new HomeNavigationScreen());
    }
};

timer.schedule(splashTask, 3000);

However, it throws IllegalStateException error, I am not sure what I am doing wrong?

I am new to eclipse and java, I am not sure how to view stack trace.

Here’s what I found:

ApplicationManagerImpl.processExited : process process switching to background: pid=260
java.lang.IllegalStateException: UI engine accessed without holding the event lock.
Timer died: Thread[Thread-310688768,5]
  • 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-17T19:21:23+00:00Added an answer on May 17, 2026 at 7:21 pm

    Diagnosis based on the original question:

    Your first step should be to read the documentation for Timer and TimerTask, which gives the following conditions for an IllegalStateException at schedule(...):

    If the timer’s task execution thread
    terminates unexpectedly, for example,
    because its stop method is invoked,
    any further attempt to schedule a task
    on the timer will result in an
    IllegalStateException, as if the
    timer’s cancel method had been
    invoked.

    Did you .stop() at some point? Do you ever call cancel()? Can you check to see if the task threw an exception which abruptly terminated the Timer thread? Are you using the same Timer for other TimerTasks? Do you trust them?

    Try wrapping your TimerTask logic with a broad exception handler and have it report directly to see if there’s an internal unexpected exception, which would cause the next call to schedule to fail as described.

    Also, a nitpick but an important one: Best practice when asking a question that includes “Why did I get this exception?” is to include the full exception and stack trace output. You’ll get much higher quality answers and you won’t have to read this text again, and then have to re-edit your question, etc.

    Guidance for your specific error:

    Well, read the exception statement. It looks like you’ve upset the UI engine. So you have two problems:

    1. You’ve upset the timer thread by handing it a task that blows up with an uncaught exception. Good policy to wrap these things in a try/catch block, where the catch operation is at least to print or log a usable stack trace and re-throw the exception.

    2. You’ve upset the UI event logic, see below…

    I don’t know the blackberry UI, but presumably what you’re trying to do needs to be done within the GUI event loop. This KB entry should help. Better yet, read the API documentation. You need to hold the GUI lock, much like in Swing, to call pushScreen(). One way to do this is to alter your code to call via invokeLater() or invokeAndWait().

    Candidate Code

    This is untested as I have never and don’t plan to do any BlackBerry development, but it compiles in my mind against the published BlackBerry API, FWIW. Try something like one of these:

    TimerTask splashTask = new TimerTask() 
    {
      public void run() {
        final UiApplication uia = UiApplication.getUiApplication();
        final Object eventLock = uia.getEventLock();
        synchronized(eventLock) {
           uia.pushScreen(new HomeNavigationScreen());
        }
      }
    };
    
    timer.schedule(splashTask, 3000);
    

    or, less likely to introduce synchronization issues and potential deadlocks:

    TimerTask splashTask = new TimerTask() 
    {
      public void run() {
        final UiApplication uia = UiApplication.getUiApplication();
        uia.invokeLater(new Runnable() { 
          public void run() {
            uia.pushScreen(new HomeNavigationScreen());
         });
        }
      }
    };
    
    timer.schedule(splashTask, 3000);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a 2 part splash screen that I've been trying to get to
I have a label on a splash screen that is displayed for 4 seconds.
I have a splash screen that I would like to fade in, while my
I have an app that displays a splash screen. The splash screen activity creates
Like many people, I have a splash screen that animates off to reveal the
I have a splash screen on the application and on that form. I have
I have a splash screen image that I display with splash.showFullScreen() but it doesn't
I have a splash screen which appears for a few seconds before the application
I'm coding a splash screen in VB.Net that displays for 3 seconds then shows
I'm trying to implement a splash screen for my webview android app, so that

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.