The trace code found that the white screen at the time of application startup continued until the draw call was completed, and any time-consuming operation in the process would result in a white-screen growth.
1.adb shell am start-w-N yourpakagename/mainactivity
-w:wait for launch to complete here's launch to complete never understood where to go
Pros: Quickly test start-up times and compare to other applications.
But the first page shows a different time.
2.System.currenttimemillis ()
Ben intends to use it to test 1 in the end who is the time, unfortunately, the date +%s%n in Android, can only print seconds, no nanosecond can not display milliseconds.
While other apps can print time before calling the shell, it seems like time is not ready to print until the shell executes. Can not be verified.
2. log.e ("Timerun", "Resume" + android.os.Process.getElapsedCpuTime ());
Printing process run time, and 2, the rapid analysis is not easy, the specific analysis is not working.
3. It's still traceview to know if there's a problem with the program.
Android.os.Debug.startMethodTracing ("Application");
Android.os.Debug.stopMethodTracing ();
Generate/sdcard/application.trace files, use TraceView to open to track time-consuming functions at startup
My program started at more than 1s, found that most of the consumption in the layout and drawing, originally if the layout of each additional large imageview, the above time will be dozens of hundred milliseconds time increments.
And the front in order to match a variety of models, the direct use of 720*720 pictures, backgrounds, masks, and so on has 5 layers, this speed soared ah.
In the future, we will use different sizes for different models. For the large size, I hope that a friend can help guide.
It's best to combine 1 and 3 to analyze it together.