Thread splashSetupThread = new Thread(new Runnable() { @Override
public void run() {
//Here do all the work not related to UI
//after finish launch home screen in main thread as below
runOnUiThread(new Runnable() { @Override public void run() { launchHomeScreen(); } });
F) There can be some UI elements in the Main Activity which can be shown after main UI component is shown e.g. A mini player in a Music application can be displayed once the songs and albums are displayed to the user. So do not write the code of those UI elements into the onCreate of Main Activity , instead write them in onWindowFocusChanged() as below:
@Overridepublic void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if(onCreateCalled && hasFocus) { onCreateCalled = false;
//write UI element inflation code
}
}
If above steps are followed then certainly launch time will be reduced.
Question ? Please comment !!!