Created
April 25, 2018 15:20
-
-
Save ricardobrg/1e91dee4ffcc2e64bb1b7e6525de0c68 to your computer and use it in GitHub Desktop.
Simplest Android Splash Screen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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