How Do I Show A Splash Screen In Android?
I want to show a splash screen when my app loads up, this is my Java code: ImageView splash = (ImageView) this.findViewById(R.id.splashscreen); splash.postDelayed(new Runnable(){
Solution 1:
You can do as follows:
privatestaticfinalintSPLASH_TIME_OUT=2000;
privatestaticfinalHandlermHandler=newHandler();
@OverrideprotectedvoidonCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
mHandler.postDelayed(newRunnable() {
@Overridepublicvoidrun() {
startActivity(newIntent(getApplicationContext(), YourActivity.class));
finish();
}
}, SPLASH_TIME_OUT);
}
Here activity_splash.xml
is your splash
Activity layout and YourActivity
is the Activity you're going to next.
Post a Comment for "How Do I Show A Splash Screen In Android?"