0
votes

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.

2
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

2 Answers

0
votes

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.

0
votes

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.