Authors: Dawn and David Griffiths
Audience: Java programmers moving to Android
Reviewer: Mike James
Head First Android Development sounds like a good way to get started, how does it fare?
The good news is that this book uses Android Studio so it is up-to-date. Of course once you are over the initial difficulties of getting starting the fact that it uses Android Studio becomes less important but it is still a plus point. However this isn't a hints and tips for using Android Studio book, the IDE is very much in the background.
Before you even think about reading this book you need to know how to program in Java or at the very least in an object oriented language and be ready to look up any aspect of Java you don't understand. This isn't a flaw with this particular book it is common to the majority of books on Android - the subject is to big to expect even an introductory book on the topic to teach you a programming language as well.
While this is a beginner's book it is an Android beginner's book which means some of the topics it covers are tough. The other point to note is that is a Head First book and as such it has a seemingly chaotic presentation with "handwritten" notes, drawings, asides, quizzes, summaries and stock photos with smart captions that are occasionally worth a smile - but only just.
If you like the Head Start approach this will all be welcome, but if you already know you hate it then move along because, for you at least, there nothing more to say. Personally I find that the Head First approach works well for some topics and poorly or even not at all for others. This one is about average - sometimes the scrawls make things look more friendly and at other points it makes difficult ideas seem even more complex.
The book starts off with a hands on approach to building your first app with Android Studio. There are lots of screen dumps and explanations. There is still a lot to get your head around in a fairly small number of pages but you have to start some where. Chapter 2 builds on the start with an example that actually does something. At this point the emphasis is on seeing things in action and finding your way around the overall structure of a project rather than deep ideas. For example it uses the Button's onClick property to set up an event handler rather than anything more general - or more complex. This is a good approach.
Chapter 3 goes on to introduce the idea of apps with multiple activities and intents. This is what most Android books do but for a beginner this doesn't seem to be the next logical thing to tackle. But if you have taken this route then Chapter 4 has little choice but to go deeper into the workings of the Activity and it explains lifecycle and how to persist data.
Chapter 5 takes up the topic that exercises the mind of most Android beginners - the UI. It looks at the task of creating a UI and starts off looking at different layout containers. It is Android Studio oriented but it does keep listing the layout XML rather than emphasising the fact that you can do most things with the designer and the properties window.
Chapter 6 moves on to more complex GUI components in the form of the ListView and its data adapters. This consists of a long example where lots of new ideas are introduced in the order they are required for the code.
Then comes the real surprise. Chapter 7 introduces the idea of using Fragments to create a modular UI and then chapter 8 takes us into the world of nested Fragments. The reason this is that to have two chapters of a beginner's book on the difficult topic of Fragments is surprising and dealing with child Fragments is even more so. Fragments aren't easy to use and some Android programmers even believe that they are more of a problem than an a solution. A lot of simple Android applications don't need to get anywhere near a Fragment and so spending so many pages on the topic when nothing has been said about conditional layouts, say, seems like a brave decision.
Even with the Head Start approach explaining the interface idiom for allowing the Fragment and Activity to communicate is tough - perhaps it seems even harder because of the approach. Then there is the issue of the back button and the back stack, which for many Fragments can simply be ignored. When we get to the point where we have to deal with the fact that the Fragment gets destroyed along with the Activity, for example when the device is rotated, then things are looking really hard!
Moving on to child Fragments is perhaps another step too far for the beginner. It might have been better to banish Fragments to an advanced book and allowed the beginner to concentrate on the sorts of things that a beginner has to cope with - like action bars which are the subject of the next chapter. Chapter 10 however introduces a multi-Fragment app - realistic but perhaps not the best place to explain things to a beginner.
Chapters 11 and 12 cover SQLite, Chapter 13 is about services and Chapter 14 explains the Material Design and the RecyclerView, which brings us to the end of the book and some appendixes.
One of the appendixes is a list of the ten things not covered - which seems like a very good idea. However, the list is way off what is missing for a beginners guide. It lists: distribution, content providers, the Web View class, Animation, maps, cursor loaders, broadcast receivers, app Widgets, nine patch graphics and tests. While you have to admit that some of these topics should have been in the book, they are not the most important omissions.
Why, for example, cover the very difficult and advanced topic of Fragments, which are designed to allow apps to adjust to different form factors when the subject of conditional layouts is completely ignored. Most Android apps can get by with good alternative layouts for different screen sizes, resolutions and orientations and Android Studio makes this even easier. Yet the topic is ignored. So are the important topics of resources, localization, simple 2D graphics, working with bitmaps and so on. The book seems to have decided to avoid the easy and make a lot of the difficult.
What all this means is that the book is a beginners level book that doesn't make much effort to cover the simple ideas needed before introducing the advanced which is far less often needed. If this book makes it to a second edition then the best idea would be to drop the fixation on Fragments and expand the basic coverage of the UI and how Android Studio helps with many basic tasks.
Not recommended for the Android beginner and only suitable for the intermediate programmer with a liking for the Head First format applied to more advanced topics.
For recommendations of Android Books see All About Android Books in our Programmers Bookshelf section
To get started with Android Studio see Android Adventures - Getting Started With Android Studio 1.0 by Mike James and if you are ready for Fragments see Android Adventures - Mastering Fragments
To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for new addition to Book Watch and new reviews.