Android performance optimization-Cold start optimization (application)

Source: Internet
Author: User

One, application (single global Only one, life cycle equivalent to the life cycle of the app)

1. Initializing global object, environment variable configuration (onCreate)

2. Get the current memory usage of the application (memory optimized)

Onlowmemory: Callback when memory is low

Ontrimmemory: Resource release based on memory usage

3. Monitor the lifecycle of all activity within the application (Activitylifecyclecallback)

4. Monitoring application configuration information Change (onconfigurationchanged)

Second, cold start (no process to have process) time calculation

Starting point: OnCreate method of Application

End point: Home activity OnCreate Method loading complete

Three, cold START process

Application constructor Method--attachbasecontext--oncreate--activity construction method--oncreate--The background of the configuration body and other properties--onstart--onresume--measurement layout drawing is displayed on the interface

Four, cold start optimization

Reduced OnCreate method Effort (lazy loading, reload when used)

Do not let application participate in business operations

Do not take a time-consuming operation in application

Do not save data in application as a static variable (memory leak, data security)

Layout/mainthread

Android performance optimization-Cold start optimization (application)

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.