Category Archives: android

Android Cookbook by Ian F. Darwin; O’Reilly Media

This book is crowd-sourced. Ian Darwin has assembled recipes from himself and over 30 other contributors to build this book.

I like cookbooks. They sit somewhere between official guides and subject-expert web writing. They represent the team effort of co-operative mutual learning as we all share advice and advance the science. Even if you don’t follow the recipe, they stimulate the taste buds and the imagination.

I read this book, all 661 pages, in a single busy day. Downloaded it over breakfast, devoured it through lunch, raced through the recipes over dinner, and finished it off in bed. Can’t remember the last time a book captivated me that much.

So, is ‘Android Cookbook’ for you?

  • Yes, if you need to know what is possible in app development for phones and tablets
  • Yes, if you are an experienced app developer but need some quick answers on new features and sensors
  • Yes, if you a cross-over developer moving from another platform. Maybe one of the many RIM developers watching your user base evaporate right now.
  • Yes, if you are new to professional development but already versed in the Linux, Eclipse, Java stack. Maybe coming out of college.
  • No, if you want to learn how to design attractive user interfaces, or you are looking for productivity advice on using your android. This cookbook is strictly by and for programmers and the screenshots are not pretty and certainly do not follow the rounded-corners philosophy of elegant visual design. But yours can! Follow recipes 6.10 and 6.11. and 7.28

Android Cookbook is thought-provoking. The problem/solution format tends to concentrate on specific tips that are intriguing on their own but hardly of value as stand-alone apps. This has the effect of making the knowledge easy to absorb, and leading the mind to envisage mash-ups of the various tips to create real and useful apps. So for example you could combine recipe 4.9 (Starting a Service After Device Reboot) with 15.3 (Loading a User’s Twitter Timeline Using JSON) and 9.4 (Creating an Advanced ListView with Images and Text) to create a fully functional Twitter client.

Android Cookbook is factually correct. I fact-checked the things I did not already know and they look right.

Android Cookbook is fast moving. The story leaps from solution to solution; each growing on the next. But it is inevitable that there are some time lapses in the solutions and a little overlap too. Recipes 6.5 and 7.2 date from 2010, while 22.2 and 22.3 are already obsolete, yet 22.4 comments on Android Market being folded into Google Play just as the book was going to press. Is it just me or is recipe 8.11 ( Creating a Reusable About Box Class, from Daniel Fowler ) and recipe 19.3 ( Obtaining Information from the Manifest File , from Colin Wilcox ) exactly the same? Buy the book and tell me if you agree.

Android Cookbook is scary in parts. At one point Ian Darwin even shows us how to embed C inside your app and potentially destroy any semblance of robustness you thought you had from the legendary Java sandbox. I was thankful he refrained from showing us a genuine use for bare-metal coding. Instead he filled the gap with a traditional algorithm; in this case how to compute a square root. Iin this case I think Ian is being a little school-masterly. Do not try this tip at home. The correct way to calculate a square root in an Android app is with Math.sqrt(x), not to use the Newton-Raphson iterative method that Ian demonstrates.

Ian likes the dry style first made popular by Kernighan and Ritchie in their 1978 White Book, of which I guess he is clearly fan. Acres of code, seasoned with a few choice wizened peppercorns all the tastier for their sparseness.

Do I miss anything in this book? Well, Ian, when you bring out the next edition can you explain more about:

  • The microphone. How can we integrate sound recording and build our own Shazam?
  • Image processing. How can we turn our cameras into Google streetviews? Is a phone (yet) capable of OCR?
  • Music making.  Lets make music, synthesize sounds, build with Midi
  • Graphics. help us construct our own charts and diagrams
  • Calendar events. Some one in the crowd must know more about integrating with the on-phone calendar.

Is it worth you buying the Android Cookbook?

  • Yes, if you are buying out of your corporate budget this will pay for itself in saved labour within hours.
  • Yes, if you are paying from your own pocket. I wish I had known tip 11.12 before I wrote my last app.
  • Maybe not yet, if you are still to become comfortable with Eclipse and Java
  • Yes, if you are an entrepreneur visualising the future.

Buy and enjoy. Android Cookbook by Ian F. Darwin; O’Reilly Media