Android Development Acceleration

Source: Internet
Author: User

Simulator speed-up:

By default, the android simulator is slow and slow, resulting in a CPU usage.

Search for a solution online and find someone has submitted the problem to the android official website.

The current solution is:

Turn off the settings for the simulator to automatically detect mobile phone Rotation

The specific location is: set-sound and display-Disable the "direction" option

 

Improve Android applicationsProgramFour principles of speed

We have previously introduced the Android app core-intent. Intent can be regarded as one of the key points of Android Application Development. It is responsible for communication and mutual coordination and calling between various components in the application. However, in Android development, many skills and principles are required for Android applications. First, we need to first understand that "acceleration" has two meanings. The first layer isCodeThe time required for execution. The second layer indicates the time that the user needs to wait for the response from the user interface. The two are very different. Of course we must improve the efficiency of code execution, but the most important thing is what the user sees. Therefore, if it is not necessary, do not let the user wait. The following are the principles for improving the running speed of Android applications.

1. Do not wait for the UI thread

The most basic principle is not to execute time-consuming operations in the user interface thread. If so, the user interface will be locked before the operation is completed (the interface will die ), this will bring a poor user experience. If it takes a long time, the system will delete the thread or prompt the user to stop the operation.

If you process some work (Business Operations) in the UI thread, no matter how smooth your code is, it is actually a pile of garbage.

Ii. Time-consuming operations

What time-consuming operations are there? The most common is network connection operations. The network status varies greatly with the environment. Good network conditions may be fast, but poor network conditions may take a long time, therefore, you cannot perform network operations in the UI thread. In addition, database operations and SD card file read and write operations should not be completed in the UI thread as much as possible. For database operations, we can create indexes to speed up program running.

3. simulators and real devices

There is also a big difference between the simulator and the real device, the simulator needs a better CPU, if your computer performance is poor, you will feel that the running speed is very slow, however, if a real device can run quickly, and the simulator uses a system hard disk, the access speed will be much faster than the real device's access to the SD card.

4. Notify users

When you need to wait, you must use progress bars to tell the user that the program is still running. Do not let the user die. Using some loading animations will give you a better user experience.

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.