Skip to content

Instantly share code, notes, and snippets.

@mahdimortazavi
Created June 28, 2016 13:17
Show Gist options
  • Save mahdimortazavi/e82cb0abb2a195bc92cebec7557d58ee to your computer and use it in GitHub Desktop.
Save mahdimortazavi/e82cb0abb2a195bc92cebec7557d58ee to your computer and use it in GitHub Desktop.
Splash Screen Full Screen
public class Splash extends Activity {
/** Duration of wait **/
private final int SPLASH_DISPLAY_LENGTH = 1000;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.splash);
/* New Handler to start the Menu-Activity
* and close this Splash-Screen after some seconds.*/
new Handler().postDelayed(new Runnable(){
@Override
public void run() {
/* Create an Intent that will start the Menu-Activity. */
Intent mainIntent = new Intent(Splash.this,MainActivity.class);
Splash.this.startActivity(mainIntent);
Splash.this.finish();
}
}, SPLASH_DISPLAY_LENGTH);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment