Android Interface Optimization Method and android Interface Optimization

Source: Internet
Author: User

Android Interface Optimization Method and android Interface Optimization

After we launched an APP, there were some experience problems in the middle. One obvious problem was that the interface was choppy. We took the following measures to solve the problem and achieved some results.

1. optimized the Interface Layer

Merge the interface layers that can be merged to reduce the rendering of the interface. In this process, the main tool used is to set the excessive rendering of the display, where the red area must be optimized.

2. Reduce the number of page refreshes

Reducing the number of page refreshes is a good interface optimization, especially for collection pages such as ListView.

[1] Use latency to reduce the number of page refreshes: we have implemented a latency mechanism, with a latency of 1 s for each refresh. When there are refresh requests in this second, the refresh time will be postponed, you must refresh the interface when it reaches 5 s at most. This effect is very obvious.

[2] determine whether or not to refresh the interface before refreshing: for other fixed interfaces, we will determine whether to refresh the interface. If the current display is the same as the display, there is no need to refresh.

[3] cache interface: if we want to update the interfaces in ListView at any time, and these updates will not result in the order of ListView, We will cache these views and directly update the views.

[4] static interface: this is a way to cache the interface. It uses static variable caching for complex interfaces. Each time you build the interface, you can adjust the static view.

3. interface model and data model Separation

In the past, we processed the data model before the View display. After the processing, the data model is displayed on the interface. These processing logics should be extracted and placed in the asynchronous thread, generate a specific interface model and display it directly.

4. Remove io operations from the main thread

This is a specific embodiment of 3. io operations such as Operation files and databases are removed from the main thread to avoid congestion of the main thread.

5. Avoid resource competition.

Reduce the generation of some resources as much as possible. For example, the new operations in the program should be minimized, and the number of threads should be properly controlled. When memory resource consumption is serious, garbage collection is frequently triggered, and skip frame is often found in logs.

Related Article

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.