0

I would like to call splashScreen activity while current activity is been executed. Once current activity finishes its load, finish splashScreen activity. How can I call one activity and keep executing current activity? Thank you.

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Intent intent = new Intent(TabBarActivity.this, splashScreen.class);
        startActivity(intent);

        setContentView(R.layout.main);

        cicle();

    }
4

3 回答 3

2

Have a ProgressBar load in your SplashScreen activity via an AsyncTask. Keep updating the progressbar in that activity and once the loading is fully completed, you can start a new activity in maybe..postExecute() method.

You can refer to this: Progressbar in Splashscreen android

于 2012-07-17T13:49:55.533 回答
1

I'd suggest this:

  1. Make the Splashscreen the entry point of your application.
  2. From the SplashscreenActivity execute the long-running task in the background (see AsyncTask and its doInBackground() method)
  3. When that's finished, switch to the next activity and transfer the background operation result (intent.putExtra...)
于 2012-07-17T13:50:52.963 回答
0

do the "loading" in splash activity instead, whenever the loading ends, launch the next activity. There is no need for something that complex

于 2012-07-17T13:48:39.960 回答