50 Android Hacks (2013)
I started learning about Android back in 2009. Android version 1.5 had just been released, and it showed a lot of potential.
In July 2009, thanks to a friend living in Australia, I got my first Android-powered device, an HTC Magic with Android version 1.5. To be honest, it processed more slowly than I expected, but I started testing the APIs and creating apps that I wanted to have on my cell phone. I sensed that Android would get a lot of attention and I knew that if I managed to create an application, it would be available to a lot of people.
I was proved right—not long afterward, there was a kick-off for Android development, which soon grew bigger and bigger. Suddenly a lot of tools and third-party libraries supporting the Android platform emerged—everything from game frameworks, like cocos2d-x, to build systems, like Apache Maven.
In November 2010 I was asked to review a book from Manning Publications called Android in Practice (www.manning.com/collins/). Delving deep into Manning’s work, it occurred to me that I could write a book about Android development using a different approach. I wanted to imitate Joshua Bloch’s Effective Java (www.amazon.com/Effective-Java-2nd-Joshua-Bloch/dp/0321356683), providing tips and patterns I had learned over all my years of developing for the Android platform.
Essentially, I wanted to gather together in one book every Android tip I have learned and provide some degree of documentation for it. That’s what 50 Android Hacks is all about: a collection of tips gathered in the process of developing different Android applications.
Something I enjoyed about Effective Java was that the book doesn’t have any particular order and I could read various sections, learning something different from each of them. After some time, I would go back to the book and find a different application for the project I was working on. I kept that in mind while writing this book. I imagine the reader investigating a hack while going to work or before going to sleep, getting new ideas for the project they’re working on.
I’m already using this book on my new projects, copying the sample code for certain tasks and using its examples to explain to my coworkers certain patterns. It’s proven to be useful for myself, and I hope it will be useful for you as well.
While writing the book and samples, I set the minimum SDK to 1.6. Most of the hacks in the book work in Android version 1.6 onward unless mentioned. You’ll notice that there are hacks specific to the newest Android versions, but most of them are recommendations or ideas that would work for every version. Every hack has an icon identifying the minimum SDK it will work with.
So pick a hack of interest to you from the table of contents and start reading. I hope you learn as much reading this book as I learned writing it.