I currently have a splashScreenActivity
that requires the User the press on a button
to go to the MainActivity
.
Would it be possible to load all the contents of MainActivity
WITHOUT MainActivity
's UI APPEARING ON TOP OF splashScreenActivity
's UI so that when he does presses the button, he is redirected to the MainActivity
and all the data is 100% loaded?
Thanks in advance
I found an answer to my problem!
Note that in my case MainActivity
can be any activity
Having a Splash Screen as a fragment
instead of an activity
allows you to overlay the MainActivity
with the fragment
, while the MainActivity
data loads in the background.
At this point, whenever you are ready, simply set the visibility of the fragment
to View.GONE
or pop it off the fragment stack getFragmentManager().popBackStack();
, and you will return (never really left) to your MainActivity
with all the data loaded.
Use Full Screen Dialog With Runnable on Main Activity
public void showsplash() {
final Dialog dialog = new Dialog(MainActivity.this, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.activity_splash_screen);
dialog.setCancelable(true);
dialog.show();
final Handler handler = new Handler();
final Runnable runnable = new Runnable() {
@Override
public void run() {
{
dialog.dismiss();
}
}
};
handler.postDelayed(runnable, 30000);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With