10 suggestions for Android app developers

Source: Internet
Author: User

With the development of mobile platforms and the continuous improvement of their applications, quality becomes the key to success or failure. Users require them to choose the installed applications with fast response and good performance. If an application cannot provide excellent functions and stable user experience, such applications will be unmounted soon.

Although Android smartphones and tablets are running faster and faster, developers still need to remember that the running environment of applications is restricted by battery, processor, and many other resources. The following are ten suggestions on how to "slim down" the application, so that the best results can be achieved on all current and future Android devices.

1) first, we must have good coding habits.

A good developer should be good at using common sense, perfect algorithms and standard design patterns. To be aware of resources, you must remember to close it and try to get it late and release it early. These long-standing coding rules are also applicable to Android Application Development, especially when using basic device services.

2) Keep blocking operations away from the main UI thread

Use AsyncTask, thread, IntentService, and custom background services to ensure application flexibility. Use the loading tool to simplify the State management of long-time data loading, such as cursors. When other programs run, your application cannot be delayed or aborted.

If an operation consumes a lot of time and resources, cancel the operation and change it to asynchronous processing, so that the application can maintain the response and the user can continue to perform various operations. This method is applicable to disk read/write, access content provider, database, and Internet, as well as parsing and other tasks that take a long time.

3) use the latest Android SDK version and API

Use the latest Android products to keep your apps up to date. With the development of the Android platform, some functions may be discarded or replaced by better functions. The core API receives bug fixes and performance improvements. The new API helps developers compile more stable applications. You must understand that the best practices always change over time, and smart developers should always be at the forefront of the entire platform.

4) use StrictMode

A new strictmode class is provided from Android 2.3, which can be used to capture the time-consuming disks, network access, or function calls that occur in the main thread of an application, and can help developers improve the program, it makes the UI and animation processed by the main thread smoother during disk read/write and network operations to prevent the main thread from being blocked.

5) Disable or minimize debugging before release

If the development cycle is long, you may have some built-in logs or debugging code in the application. Make sure that these functions are minimized or completely disabled before release.

6) Make sure that the UI layout is simple and elegant

A simple screen not only facilitates reading, but also speeds up loading. Instead of building too many unnecessary functions on a single screen, it is better to spend time developing elegant user interfaces. The simple and elegant UI not only improves the application performance, but also improves the efficiency of using the application.

7) Adjust application resources based on the target device

To be loaded as efficiently as possible, you need to adjust the corresponding resources, especially image resources, according to the configuration of specific devices. To make the application package file suitable for different devices, you can first add only the core resources required to run the application, and then download the relevant content based on the specific device.

8) use the hierachy viewer visual debugging tool

Hierachy Viewer allows developers to quickly locate, solve, and improve development efficiency when designing, debugging, and adjusting interfaces.

9) layoutopt for Layout Optimization

Layoutopt is a simple command line tool that helps you find unnecessary control nesting and reduce layout resources, making your application "slim ". The fewer controls and the lighter the layout, the better the performance.

10) Use traceview and Other Android tools for analysis

The android SDK comes with many tools for application analysis, the most popular of which is traceview. This graphic tool can help you debug and find performance bottlenecks in applications.

Conclusion

There are many ways to improve the performance of Android applications. Some require specific algorithms, and some rely on practical debugging and performance monitoring technologies. Fortunately, the Android platform comes with a number of free utilities to help track and solve performance problems in applications.

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.