Best practices

Now that we know what can happen in memory while our application is active, let's examine what we can do to avoid memory leaks and memory churns and optimize our memory management in order to reach our performance target, not just in memory usage, but in garbage collection attendance, because, as we know, it stops any other operation from working.

In the following pages, we will go through a lot of hints and tips using a bottom-up strategy: starting from low-level shrewdness in Java code to highest-level Android practices.

Data types

We weren't joking: we are really talking about Java primitive types, as they are the foundation of all the applications and it's really important to know how to deal with them, even though it may be obvious. ...

Get Android High Performance Programming now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.