In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to optimize App startup in android, which is very detailed and has certain reference value. Friends who are interested must finish it!
Do Android development, must have been written to the startup page, here to do some initialization operations, and is to display promotion information.
A very ordinary page, the previous test also proposed to me bug, when the application is started, sometimes there is a white screen / black screen. What I could do at that time was to minimize the time-consuming operation, which was also mentioned in the above doctor's article, but I really didn't know before to optimize this problem in a thematic way.
The following is a summary of optimizing the startup page by theme (the doctor also mentioned that initialization in child threads and initialization using IntentService belong to asynchronous initialization and delayed initialization, not to mention)
Optimize the white / black screen at startup by modifying the theme
The principle please move to the doctor's article, I will not repeat, the reason why we can see the white screen or black screen, is related to our theme, because the default theme used by the system, the background color is white / black. So we customize a theme so that the default style is what we want, which optimizes the white / black screen problem.
First, let's customize a theme and set the background we want.
@ drawable/start_window
Custom background start_window.xml
* use our custom theme on the manifest file setup startup page
At this point, in order to show the effect, we simulate a white / black screen delay operation before the startup page loads.
Public class SplashActivity extends AppCompatActivity {@ Override protected void onCreate (Bundle savedInstanceState) {super.onCreate (savedInstanceState); / / initialize the white screen and black screen SystemClock.sleep (1000); setContentView (R.layout.activity_splash) / / stay for 2 seconds to enter the main page new Handler () .postDelayed (new Runnable () {@ Override public void run () {Intent intent = new Intent (SplashActivity.this, MainActivity.class); startActivity (intent); finish ();}}, 2000) }} these are all the contents of the article "how to optimize App startup in android". Thank you for reading! Hope to share the content to help you, more related knowledge, 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.