Android boosts app startup speed

Source: Internet
Author: User

The company's app is too slow to start faster and requires more

So I did the research.

Reduce the starting speed from 2000ms to about 800ms.

Record the speed-up method first

    1. The logic code in application's OnCreate method is all used.

      New Handler (). Post (New Runnable ()); parcel

    2. The OnCreate () method of activity is so;

This method drags the execution of the code all the way to Onresumer.

3 and then in OnCreate Onresume method everything you think will hinder the startup speed of the method and code plus log printing information

Look at the picture

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/58/DD/wKioL1S_RTKgcWS1AAFPZs3lbvk220.jpg "title=" Qq20150121141402.png "alt=" Wkiol1s_rtkgcws1aafpzs3lbvk220.jpg "/>


Look at the click of Activitymanager he will print the time, just look at the print time before the log printed what information

Then determine if the code for the printed information will block the app's startup speed.

If it does, handler.post the code all new or new Thread off. But the order will have a succession,

Print down log and experience it slowly.


My app scans the database when it's started, but Newhandler new Thread is still running before the start time, which proves it will scan the database when it starts, and it's 100ms slower. So with new Handler.postdaley (), extended 90ms operation, found that the scanned module can be dragged to the print time to run, the app started after the view to start scanning the database, the speed has increased 100ms

reached about 800ms.


4. Also pay attention to the depth of the layout and try to simplify the layout.

Android boosts app startup speed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.