Skip to content

Instantly share code, notes, and snippets.

@louisbl
Created February 2, 2015 13:33
Show Gist options
  • Save louisbl/36a11ce2b86328aa7e4a to your computer and use it in GitHub Desktop.
Save louisbl/36a11ce2b86328aa7e4a to your computer and use it in GitHub Desktop.
Splash with timeout
public class SplashActivity extends FragmentActivity {
private static final int SPLASH_TIME_OUT = 1500;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(SplashActivity.this, HomeActivity.class);
// start Home Activity
startActivity(i);
// close the splashscreen
finish();
}
}, SPLASH_TIME_OUT);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment