BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News How to Improve Android App Performance

How to Improve Android App Performance

This item in japanese

Lire ce contenu en français

Performance is key to mobile apps. Google provides a lot of training material to improve performance in Android apps. A brief overview of tips and techniques.

A comprehensive approach to performance entails a ground-up work on aspects such as:

Mastering all this material can be quite daunting, so Shane Conder and Lauren Darcey, authors of several books on Android development, suggest several tips that include:

  • using sound coding practices
  • not using the main thread for blocking operations
  • keeping layouts simple and elegant
  • tailoring resources to devices
  • using traceview and other profiling tools.

Those tips will help you up-front when you are developing your app. What happens when you already have almost finished you app and find that its performance is less than satisfactory? Tutsplus’ Jessica Thornsby identifies three key areas you can easily inspect:

  • overdrawing: this happens every time the GPU paints a background and then some other graphical artifact above it. Too much overdraw can kill an app’s performance. Android supports a “Debug GPU Overdraw” mode that will highlight overdrawn areas by using different colors that show home many times redrawing did happen. So you have a clue at which areas of your layout you should modify.

  • rendering pipeline: the time it takes to render your UI is proportional to the number of view in your hierarchy. Android SDK Hierarchy Viewer, can help inspect a view hierarchy and find ways to flatten it. It also provides profiling information about how long it takes for each view to render.

  • memory leaks: despite being garbage collected, Android is not exempt from memory leaks. Android Memory Monitor, which is built into Android Studio, allows you to check how much memory your app is using. Another tool that can help with memory leaks is the Android Device Monitor’s Heap tab, which provides much more detailed information about which objects are actually taking your device’s memory.

Finally, streamlining an app’s UI is also considered the most important performance tip by Jeannie Liou, who points at the benefits of using a Relative layout instead of a linear layout to organize your views.

Rate this Article

Adoption
Style

BT