I'm trying to create a simple loading screen, during which I create new background thread, check some settings, and then start my main activity. I don't need the status bar / activity bar during this time, and I'm executing code to hide it.
During prototyping i'm using system.sleep to simulate waiting. I intent to add a delay of 1 second in my final version to prevent flashing.
However, it seems that system.wait is always happening before the screen is painted (see code below). My understanding was that by the time onResume is called Android will have painted the screen already, but that doesn't seem to be the case. Is there a different way something like this should be implemented?
Code below:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loading_screen);
//hide action bar / system bar
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
ActionBar actionBar = getActionBar();
actionBar.hide();
}
public void onResume(){
super.onResume();
//TODO: Start a background thread. Wait during prototyping instead
SystemClock.sleep(3000);
}