Skip to content

Instantly share code, notes, and snippets.

@ricardobrg
Created April 25, 2018 15:20
Show Gist options
  • Save ricardobrg/1e91dee4ffcc2e64bb1b7e6525de0c68 to your computer and use it in GitHub Desktop.
Save ricardobrg/1e91dee4ffcc2e64bb1b7e6525de0c68 to your computer and use it in GitHub Desktop.
Simplest Android Splash Screen
package br.com.brgweb.splashtest;
import android.content.Intent;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.os.Handler;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.hide();
}
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(SplashActivity.this, MainActivity.class);
startActivity(i);
finish();
}
}, 2000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment