As mobile platforms evolve and their applications improve, quality becomes the key to success. Users are becoming more demanding. As developers, we are very fortunate in these days, because there are a lot of reference materials and convenient development tools to use. But it also means we have a big challenge. How to ensure the quality and quantity of efficient development, is not the pursuit of a program developer.

Here are 10 tips for app developers to help you code more effectively and be a more efficient coder.

1) Create a good coding style

A good developer should use common sense, sound algorithms, and standard design patterns. For example, Java is object-oriented, which means we can encapsulate and simplify it. To make a function, we need to treat it like a human body, where the hands and feet can do different tasks at the same time, without being affected by each other, and at the same time under the control of the central nervous system of the brain. The second is to have the awareness of releasing resources, open the cursor must remember to close, try to achieve late access, early release.

2) Keep blocking operations away from the main UI thread

1, the Handler + Thread

2, AsyncTask

3, use IntentService and custom background services when using services.

Because these built-in asynchronous processing components can save you a lot of memory overhead. Don’t let your application lag or stall while other applications are running.

  

3) Learn to use the latest Android SDK versions and apis

Use the latest SDK for Android and Java to keep up with The Times faster. After all, the new API is relatively stable, so it can solve problems and fix bugs faster with the new API. The new API will help developers write more stable applications. Understanding that best practices change over time, smart developers should always be at the forefront of the platform.

4) Learn to catch exceptions (UncaughtExceptionHandler)

Fragmentation of The Android system causes serious crashes of applications. A program that runs well on the emulator may crash when installed on a certain phone. Moreover, it is often the program after release in the user side of the crash phenomenon. So how to catch and collect crashes on The Android platform becomes more and more important if we had used the exception catching mechanism.

Note:

In an Android application

Global applications, activities, and services all belong to the main UI thread, which is named “main” by default.

Therefore, add UncaughtExceptionHandler to the UI main thread in the Application

UncaughtException events in activities and services can be handled.

5) Minimize the use of third-party frameworks

Many people rely too much on the third party framework, resulting in the most basic things have forgotten, remember online there is such a funny picture: do not tell me what the underlying principle, framework kernel, old man knocking code is a shuttle! Are we all affected by this?! Smart programmers mostly write their own framework, solid foundation!

6) Keep the UI layout simple and elegant

The simple screen display is not only easy to read, but also speeds up loading. Instead of piling too many unnecessary features on a single screen, take the time to develop an elegant user interface. A simple and elegant UI not only improves application performance, but also improves the efficiency with which users use the application.

7) Adjust application resources according to the target device

To load the images as efficiently as possible, you need to adjust the resources, especially the image resources, according to the device configuration. To make the application package file suitable for different devices, you can add only the core resources needed to run the application first, and then download related content based on the device.

8) Layout optimization

HierarchyViewerUI Performance analysis tools are used to analyze layout file performance, hierarchy nesting, UI layout complexity and redundancy analysis, View nesting redundancy levels, View performance metrics: measurement, layout, rendering time to draw.

Layoutopt is a simple command line tool that helps you find unnecessary control nesting and reduce layout resources to make your application “slim”. The fewer controls and shallower the layout, the better the performance.

9) Learn to analyze with tools

1. Use Traceview performance analysis tool for analysis

2. The MAT tool is available if you use Eclipse

3, the third party more intelligent performance analysis tool BlockCannery a powerful Android program debugging tool, easy to help you find the stuck

4. Use Stetho, the powerful debugging tool for AndroidStudio

5. Learn DDMS

6. Use Hierachy Viewer visual debugging tool

7. Hierachy Viewer can conveniently locate problems quickly, solve problems and improve development efficiency when developers design, debug and adjust the interface.

> recommended blog (http://blog.csdn.net/axi295309066/article/details/52733222)Copy the code

The Android SDK comes with a number of tools for app analytics, the most popular of which is Traceview, a graphical tool that helps you debug and find performance bottlenecks in your app.

10) Don’t take on too much. Put your rice bowl to good use

Whether you’re working on Java or mobile, you can’t just learn everything you see. Anyway, that’s the way I am. If I were to learn another language, I would have mastered 7 points. Even if we don’t use android for half a year, we will forget something. Everyone is forgetful. Maybe I’m getting on in years. I think as the ordinary people of your door is the same!

After all, no door is the most popular, after all, no door is the worst. Remember, Android developers get paid a lot of money, and you’re next!

11) Why must we focus on Java basics?

For a developer learning Android and Java, the Java foundation is very important. Why do you say that?

Probably most people ignore this question. One of the brothers in the group asked me: Why I have been working for three or four years, but I have always been abused in interviewing big companies, especially BAT companies, sometimes I can’t answer the most basic questions well! He mentioned an interview question at a financial company that used nodes to simulate lists for adding, deleting, changing and checking. So he pondered for a long time to write is a mess.

I was a little surprised to see this! Isn’t that the simplest custom single linked list? So I severely ‘criticized’ him, do not only use the third party programming, for you may be the simplest is often the most important, to pay attention to the Foundation of Java!

Yes, some people have been doing development for more than three years, and it’s always hard to get into a big company for a good reason. That’s why others can write open source frameworks and you can’t!

conclusion

As a new era of code farmers, calm down, step by step. Programmer, how can you sweep the world? Here I have put forward some of my own views, if there are points that are not in place, I hope you can exchange and correct. Finally, I wish you to go higher and farther on this road!

About more:

Collection of technical articles in the first half of the year – 184 articles classified summary

NDK project actual combat – high imitation 360 mobile phone assistant uninstall monitoring

Interview Questions for 2017 (Android)

“Is there anything else you’d like to ask” — how to answer an interviewer’s question

Android image selection to clipping step by step pit

Believe in yourself, there is nothing impossible, only unexpected

If you think this article is helpful to you, welcome to join the wechat public number: Terminal R&D Department

Technology + Workplace