How to realize Splash screen in Android
In this article, the editor introduces "how to achieve the splash screen in Android" in detail, the content is detailed, the steps are clear, and the details are handled properly. I hope that this "how to achieve the splash screen in Android" article can help you solve your doubts.
I tried Handler () here, through splashHandler.sendMessageDelayed (msg, SPLASHTIME); the time of the second parameter in the method is controlled as the occurrence time of the Android splash screen. Of course, the activity of the splash screen is used as the main activity, and the following main program is realized by startActiivity.
@ Override public void onCreate (Bundle icicle) {super.onCreate (icicle); requestWindowFeature (Window.FEATURE_NO_TITLE); setContentView (R.layout.splash); Message msg = new Message (); msg.what = STOPSPLASH; splashHandler.sendMessageDelayed (msg, SPLASHTIME);} @ Override public void onCreate (Bundle icicle) {super.onCreate (icicle); requestWindowFeature (Window.FEATURE_NO_TITLE); setContentView (R.layout.splash); Message msg = new Message (); msg.what = STOPSPLASH SplashHandler.sendMessageDelayed (msg, SPLASHTIME);}
Msg.what = STOPSPLASH actually gives a name to the message to prevent too many messages from being confused.
Private Handler splashHandler = new Handler () {@ Override public void handleMessage (Message msg) {switch (msg.what) {case STOPSPLASH: startActivity (new Intent (getBaseContext (), Main.class)); finish (); break;} super.handleMessage (msg);}} After reading this, the article "how to achieve splash screen in Android" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, you are welcome to follow the industry information channel.