Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Splash screen in Android

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report