0

In my application i am using splash screen with time intervel when app starts for few seconds like 5 or 6 seconds . this is the code am using

private static int SPLASH_TIME_OUT = 5000;

new Handler().postDelayed(new Runnable() {
   @Override
   public void run() {
        Intent i = new Intent(NativeSplash.this, MainActivity.class);
        startActivity(i);               
    }
}, SPLASH_TIME_OUT);

Here i am facing weird problem while loading MainActivity( AppEntry code developed in FlashBuilder AIR ). while it's loading blank screen appearing before MainActivity comes to front.

Is it possible to keep splash screen while loading MainActivity instead of showing blank screen (with out time Interval) ?

I can show splash screen for few minutes but loading main activity takes time. That loading time varies device to device. so planning to make splash screen independent on time.

RajaReddy PolamReddy
  • 22,428
  • 19
  • 115
  • 166
  • what exactly you are doing in main activity and why it's taking time explain clearly.. one solution when splash time over in main activity display a progress bar until it finishes background tasks.. – pavanmvn Nov 21 '13 at 08:14

2 Answers2

0

I would recommend making an InitialLoading activity or fragment that does all the loading and starts when the app is started. InitialLoading could have a layout that simply shows your splash screen and finishes when the loading is done.

Sean Croft
  • 375
  • 1
  • 2
  • 8
0

Put your all loading code of MainActivity in AsyncTask.... Show the Splash screen until loading finishes..

On post execute of Async Task, start new activity i.e. MainActivity.

SweetWisher ツ
  • 7,296
  • 2
  • 30
  • 74