10 tips for Android app developers

Source: Internet
Author: User

With the development of mobile platform and the continuous improvement of its application, quality becomes the key to success. Users require that they choose to install an application that responds quickly and with good performance, and if an app does not provide superior functionality and a stable user experience, that application is destined to be uninstalled quickly.

While Android smartphones and tablets are now running faster, developers need to keep in mind that the application's operating environment is still constrained by resources such as batteries and processors. Here are 10 tips on how to apply "slimming" so that you can run the best results on all of your Android devices now and in the future.

   1) First of all to have good coding habits

A good developer should be good at using common sense, perfect algorithms, and standard design patterns. To have the resource consciousness, open the need to remember to close, as far as possible to obtain late, early release. These long-standing coding guidelines also apply to Android application development, especially when using basic device services.

   2) Keep the blocking operation away from the main UI thread

Ensure application flexibility by using Asynctask, threading, Intentservice, and custom background services. Use the Load tool to simplify the state management of long-time loading data such as cursors. When there are other programs running, you can't let your app lag or abort.

If an operation consumes more time and resources, cancel the operation and replace it with asynchronous processing so that the application remains responsive and the user can continue with various actions. This approach applies to disk read and write, access to content providers, databases, and the Internet, as well as parsing and other tasks that take a long time.

   3) Use the latest Android SDK version and API

Keep your app up-to-date with Android with the latest products from the Android platform. As the Android platform continues to evolve, some features may be deprecated or replaced by better features, core APIs receive bug fixes and performance improvements, and new APIs help developers write more stable applications. To understand that the best practices always change over time, smart developers should always be at the forefront of the entire platform.

   4) Consider using Strictmode

Starting with Android 2.3, a new class, Strictmode, can be used to capture time-consuming disk, network access, or function calls that occur in the main thread of the application, helping developers to improve their programs, making the main thread processing UI and animations smoother when disk reads and writes and network operations. Prevent the main thread from being blocked.


   5) Disable or minimize commissioning before release

If the development cycle is long, you are likely to have some log or debug code built into your app, ensuring that these features are minimized or completely disabled before publishing.

   6) Ensure a simple and elegant UI layout

The simple screen is not only easy to read, but also speeds up loading. Rather than piling up too many unnecessary features on a single screen, take the time to develop an elegant user interface. The simple and elegant UI not only improves application performance, but also increases the efficiency of the user's use of the app.

   7) Adjust the application resources according to the target device

To be loaded as efficiently as possible, the appropriate resources need to be adjusted according to the configuration of the specific device, especially the picture resources. To make the app package file work well for different devices, you can first add only the core resources that are needed to run the app, and then download the content based on the specific device.

   8) using the Hierachy Viewer Visual debugging tool

Hierachy Viewer can easily design, debug and adjust the interface, quickly locate problems, solve problems, and improve development efficiency.

   9) Use layoutopt for layout optimization

Layoutopt is a simple command-line tool that helps find unnecessary nesting of controls and reduces layout resources, making it possible for your app to be "slim". The fewer controls, the lighter the layout hierarchy, the better performance.

   10) Use TraceView and other Android tools for analysis

The Android SDK comes with a number of tools for application analysis, the most popular being traceview, a graphical tool that helps you debug and find performance bottlenecks in your app.

   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 techniques. Fortunately, the Android platform comes with a number of free utilities that can help track and resolve performance issues in your application.

10 tips for Android app developers

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.