Author: Dave Smith & Jeff Friesen
Publisher: Addison-Wesley, 2010
Audience: Intermediate level
Reviewer: Harry Fairhead
Android is a complex and generally poorly explained platform - can a book of recipes help?
Many recipe and cookbook style book are actually tutorials broken down in to small sections. The clue to this book's nature is its subtitle - A Problem-Solution Approach. It does attempt to introduce Android programming in some sort of logical order but by posing questions and answering them mostly in code.
The first part of the book gives a general introduction to Android and deals with creating your first program. The book's Q&A format really only gets going proper at Chapter 2 which deals with the user interface. This is a collection of topics such as customizing the window, creating a dialog box, displaying a popup menu and so on. This is all very random and there isn't a logical progression thought the material. if you happen to be interested in any of the topics covered then you will find the answer interesting but if you haven't hit that particular problem there is very little that generalizes. For example in the short section on "Dismissing Soft Keyboard" we are introduced to the hideSoftInputFromWindow method of the Input Method Manager but the Input Method Manager isn't explained or put into context. It is also worth saying that there is nothing about the majority of widgets, nothing on layouts and nothing about styles and themes. Ideas such as fragments are introduced, but only as part of a fairly long and complex example which makes it difficult for the beginner.
Chapter 3 is about communications and networking and it is also a random selections of topics, but given that the total topic is much smaller the coverage appears to be better. We start off looking at using WebView in various ways. Some of the ideas such as using a REST interface should be obvious if you have had a wider experience of HTML. The examples are also very long - three or four pages of code. It also covers SMS, Bluetooth, NFC and USB.
Chapter 4 is about working with device hardware and media. Again a small enough topic to be covered reasonably well in the space. Topics include MapView, the camera, Audio, orientation. The coverage of media is very limited.
Chapter 5 is about persisting data starting from the preference screen, and working with files through to using SQLlite. Chapter 6 is about interacting with the system - notifications, tasks, contacts, media and so on.
The remainder of the book isn't 100% mainstream Android, but you might find it interesting. Chapter 7 is about creating and using Java libraries within Android. Chapter 8 is about the NDK and working with Renderscript - not something everyone will need to do.
This is not a beginner's book and even though it attempts to tackle things in an order of difficulty it really is just a random collection of topics. How well the random selection covers the material depends on the size of the whole topic. For example, the first section on the user interface was the least successful, from my point of view, as there were many things it left out - despite it being over 200 pages and the longest chapter in the book. Other chapters were more successful because of the smaller size of the total subject matter. It is also important to realize that this book is light on explanation and ideas and strong on examples. The code usually outweighs the non-code descriptions by a few pages. If you want a book of code examples then this might be a plus point for you - personally, I prefer to understand the principles behind the design of the system as it generalizes better.
This is a big book and if you have it on your book shelf there are undoubtedly going to be recipes that you turn to sooner or later and they will be helpful to you, but more so if you prefer code over explanation. This is not a must-have book, but if your budget stretches to it then having it on your shelf is a good idea.