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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:56:48+00:00 2026-06-10T17:56:48+00:00

In my application I have created a SplashScreen that will b shown for 5

  • 0

In my application I have created a SplashScreen that will b shown for 5 Seconds and after that it executes an if else case depending upon the values stored in the Preference file. If Preference file contains values then the AsyncTask code will run else the Login form will load. When i try to run my application. The thread is going to the Login form with the help of intent but when it comes to AsyncTask my application shows a force close error message.

This is my SplashScreen code:

public class SplashScreen extends Activity {

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

    Thread timer = new Thread()
    {
        public void run()
        {
            try
            {
                sleep(5000);
            }
            catch(InterruptedException e)
            {
                e.printStackTrace();
            }
            finally
            {
                if(GoGolfPref.getEmail(SplashScreen.this)!=null && GoGolfPref.getPass(SplashScreen.this)!=null)
                {
                    new LoadingScreen(SplashScreen.this, SplashScreen.this).execute("login_page", Login.url+GoGolfPref.getEmail(SplashScreen.this)+"/"+GoGolfPref.getPass(SplashScreen.this));
                }
                else
                {
                    Intent in = new Intent(SplashScreen.this, Login.class);
                    startActivity(in);
                    finish();
                }
            }
        }
    };
    timer.start();
}

}

This is the error I am getting:

08-29 07:25:58.040: E/AndroidRuntime(2365): FATAL EXCEPTION: Thread-10
08-29 07:25:58.040: E/AndroidRuntime(2365): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
08-29 07:25:58.040: E/AndroidRuntime(2365):     at android.os.Handler.<init>(Handler.java:121)
08-29 07:25:58.040: E/AndroidRuntime(2365):     at android.app.Dialog.<init>(Dialog.java:101)
08-29 07:25:58.040: E/AndroidRuntime(2365):     at android.app.AlertDialog.<init>(AlertDialog.java:63)
08-29 07:25:58.040: E/AndroidRuntime(2365):     at android.app.ProgressDialog.<init>(ProgressDialog.java:80)
08-29 07:25:58.040: E/AndroidRuntime(2365):     at android.app.ProgressDialog.<init>(ProgressDialog.java:76)
08-29 07:25:58.040: E/AndroidRuntime(2365):     at com.pnf.gogolf.LoadingScreen.<init>(LoadingScreen.java:130)
08-29 07:25:58.040: E/AndroidRuntime(2365):     at com.pnf.gogolf.SplashScreen$1.run(SplashScreen.java:32)

How to get this working?

Thanks in advance…

  • 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-10T17:56:49+00:00Added an answer on June 10, 2026 at 5:56 pm

    The problem is you’re making changes to the UI somewhere, but they’re not being done on the UI thread. Anything to do with the user interface has to be done on the UI thread. You do that by encapsulating your code in another runnable and calling runOnUiThread():

    runOnUiThread(new Runnable() {
      @Override
      public void run() {
       // set some text views or something
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an application that connect on a web-server and reads an xml
I have the following requirement: I have created a Flash application that is embedded
In my application i have created a UIViewController page in that i have taken
I have created a web application in that application i have added two folder.
I have created a play application and have some models. One of them contains
I have created application where i just need to access data form assets folder.
I have created one Catalyst application and I have created Schema and Model using
I have an application where i have created a thread which must check the
I have an application where I have a Shipment model. I have created a
I have created an application in windows form. Once I submit the application, the

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.