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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:15:24+00:00 2026-06-14T17:15:24+00:00

I created splash screen to my android project, if i run it splash screen

  • 0

I created splash screen to my android project, if i run it splash screen appears for a while and displays force close message, what should i do to navigate to the next page? any suggestions?

public class LoadingScreen extends Activity implements LoadingTaskFinishedListener {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Show the splash screen
    setContentView(R.layout.activity_loading_screen);
    // Find the progress bar
    ProgressBar progressBar = (ProgressBar) findViewById(R.id.Progressbar);
    // Start your loading
    new LoadingTask(progressBar, null).execute("www.google.co.uk"); // Pass in whatever you need a url is just an example we don't use it in this tutorial

}

// This is the callback for when your async task has finished
public void onTaskFinished() {
    completeSplash();
}

private void completeSplash(){
    startApp();
    finish(); // Don't forget to finish this Splash Activity so the user can't return to it!
}

private void startApp() {
    Intent intent = new Intent(LoadingScreen.this, Rebuix.class);
    startActivity(intent);
}

}

My manifest file

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<uses-permission android:name="android.permission.INTERNET" />

<application
    android:icon="@drawable/rebuix"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".LoadingScreen"
        android:label="@string/title_activity_loading_screen" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".Rebuix"
        android:label="@string/title_activity_rebuix" >
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.rebuix.com.Rebuix" />
    </activity>
    <activity
        android:name=".Login"
        android:label="@string/title_activity_login" >
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.rebuix.com.Rebuix" />
    </activity>

Logcat

11-23 13:13:03.798: I/Tutorial(459): Starting task with url: www.google.co.uk
11-23 13:13:14.156: D/AndroidRuntime(459): Shutting down VM
11-23 13:13:14.156: W/dalvikvm(459): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-23 13:13:14.166: E/AndroidRuntime(459): FATAL EXCEPTION: main
11-23 13:13:14.166: E/AndroidRuntime(459): java.lang.NullPointerException
11-23 13:13:14.166: E/AndroidRuntime(459):  at com.rebuix.com.LoadingTask.onPostExecute(LoadingTask.java:68)
11-23 13:13:14.166: E/AndroidRuntime(459):  at com.rebuix.com.LoadingTask.onPostExecute(LoadingTask.java:1)
11-23 13:13:14.166: E/AndroidRuntime(459):  at android.os.AsyncTask.finish(AsyncTask.java:417)
11-23 13:13:14.166: E/AndroidRuntime(459):  at android.os.AsyncTask.access$300(AsyncTask.java:127)
11-23 13:13:14.166: E/AndroidRuntime(459):  at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
11-23 13:13:14.166: E/AndroidRuntime(459):  at android.os.Handler.dispatchMessage(Handler.java:99)
11-23 13:13:14.166: E/AndroidRuntime(459):  at android.os.Looper.loop(Looper.java:123)
11-23 13:13:14.166: E/AndroidRuntime(459):  at android.app.ActivityThread.main(ActivityThread.java:4627)
11-23 13:13:14.166: E/AndroidRuntime(459):  at java.lang.reflect.Method.invokeNative(Native Method)
11-23 13:13:14.166: E/AndroidRuntime(459):  at java.lang.reflect.Method.invoke(Method.java:521)
11-23 13:13:14.166: E/AndroidRuntime(459):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-23 13:13:14.166: E/AndroidRuntime(459):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-23 13:13:14.166: E/AndroidRuntime(459):  at dalvik.system.NativeStart.main(Native Method)

LoadingTask class

public class LoadingTask extends AsyncTask<String, Integer, Integer> {

public interface LoadingTaskFinishedListener {
    void onTaskFinished(); // If you want to pass something back to the listener add a param to this method
}

// This is the progress bar you want to update while the task is in progress
private final ProgressBar progressBar;
// This is the listener that will be told when this task is finished
private final LoadingTaskFinishedListener finishedListener;

/**
 * A Loading task that will load some resources that are necessary for the app to start
 * @param progressBar - the progress bar you want to update while the task is in progress
 * @param finishedListener - the listener that will be told when this task is finished
 */
public LoadingTask(ProgressBar progressBar, LoadingTaskFinishedListener finishedListener) {
    this.progressBar = progressBar;
    this.finishedListener = finishedListener;
}

@Override
protected Integer doInBackground(String... params) {
    Log.i("Tutorial", "Starting task with url: "+params[0]);
    if(resourcesDontAlreadyExist()){
        downloadResources();
    }
    // Perhaps you want to return something to your post execute
    return 1234;
}

private boolean resourcesDontAlreadyExist() {
    // Here you would query your app's internal state to see if this download had been performed before
    // Perhaps once checked save this in a shared preference for speed of access next time
    return true; // returning true so we show the splash every time
}


private void downloadResources() {
    // We are just imitating some process thats takes a bit of time (loading of resources / downloading)
    int count = 10;
    for (int i = 0; i < count; i++) {

        // Update the progress bar after every step
        int progress = (int) ((i / (float) count) * 100);
        publishProgress(progress);

        // Do some long loading things
        try { Thread.sleep(1000); } catch (InterruptedException ignore) {}
    }
}

@Override
protected void onProgressUpdate(Integer... values) {
    super.onProgressUpdate(values);
    progressBar.setProgress(values[0]); // This is ran on the UI thread so it is ok to update our progress bar ( a UI view ) here
}

@Override
protected void onPostExecute(Integer result) {
    super.onPostExecute(result);
    finishedListener.onTaskFinished(); // Tell whoever was listening we have finished
}

}

  • 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-14T17:15:26+00:00Added an answer on June 14, 2026 at 5:15 pm

    change

    new LoadingTask(progressBar, null).execute("www.google.co.uk");
    

    to

    new LoadingTask(progressBar, this).execute("www.google.co.uk");
    

    I think the second param should be a LoadingTaskFinishedListener.

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

Sidebar

Related Questions

Ok, so i created a very simple splash screen using this tutorial: http://p-xr.com/android-tutorial-how-to-make-a-basic-splash-screen/ The
My android app will take some time to display my splash screen.It displays black
Has anyone created a custom Silverlight Splash screen to replace the blue balls circular
I have an app that displays a splash screen. The splash screen activity creates
I have a question that I have a splash screen in my android app
I am having trouble with this splash screen. The first one should last 3
I created my splash screen using the method mentioned here: http://delphi.about.com/od/formsdialogs/a/splashscreen.htm I need to
I've created a two splash screen iPhone app. Afterwards user is taken to first
Hey all, I've created a loading/splash screen that loads at the beginning of my
I created a simple splash screen application, and it works just fine only when

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.