Book Review: Programming Android

<!– –>

Sorry readers (both of you), but I’m doing another book review! This time I’m reviewing the book Programming Android by Mednieks, Dornin, Meike, and Nakamura.

Why I bought this book

Despite now having worked on Android apps as my main source of income for the past year and a half, I couldn’t help but feel like there were certain aspects of the Android framework that I have probably skipped over or not encountered yet with the apps that I’ve written so far. Thanks to iSyncr WiFi and Cheetah Sync, I’ve done a lot of networking / file transfer / iTunes development, and a decent amount of UI design, fragment work, etc., but I wasn’t sure that I’d really learned everything that an Android dev should know, so I bought this book to help fill in the gaps.

Chapter 1: Your Toolkit

This chapter deals mostly with installing Eclipse and the Android SDK on your development machine and getting started with your first Hello World Android app. This chapter looks pretty good actually for anyone new to Android, but fortunately I’ve already learned all of this stuff =)

Chapter 2: Java for Android

I actually really enjoyed this chapter, because prior to working on Android I worked mostly in C++ and .NET, so there’s a fair bit of Java trivia in this chapter that I found informative and amusing. Some of the more interesting things in this chapter:

  • Java is strictly pass-by-value. This is actually just a footnote in the book, but extremely important to know as a Java developer.
  • Static vs. dynamic classes. Top-level classes are “static” by default, because they belong to no other class instance, but classes defined inside other classes are “dynamic” because they belong to the top-level class instance – this is why inline classes have access to the parent class’s variables.
  • Java collections. A short discussion of the main collection types in Java was appreciated, even if I already knew this stuff =)
  • Anonymous classes. These are supported in Java / Android, and are very useful for creating event listeners (eg. view.setOnKeyListener(new View.OnKeyListener() { });).
  • Multithreading. This was perhaps the most enlightening of all. Did you know that the synchronized keyword serializes access to data visibility as well as access to the code block it surrounds? I was definitely not aware of this prior to reading this chapter =)

Chapter 3: The Ingredients of an Android Application

This chapter is a relatively interesting discussion of the basic components that make up an Android app: Activities, Intents, Tasks, Services, and Content Providers. There’s also some basic information on the Android manifest, application resources, and the application life cycle. Not a bad chapter.

Chapter 4: Getting Your Application Into Users’ Hands

This chapter deals mostly with using signing certificates to sign your app, some very basic information on submitting your app to the Android Market, and a brief mention of supporting different screen sizes. There’s not much detail here as far as the actual publication of the app or how exactly to make your app work well with different screen sizes and densities, but considering how thorough the Android Dev Guide is in terms of supporting multiple screens, the authors probably thought it would be silly to add all of this information to the book.

Chapter 5: Eclipse for Android Software Development

This chapter is mostly a treatise on the different kinds of views you can use in Eclipse while writing code or debugging your app. For seasoned Eclipse users, this section is pretty skippable. The chapter also mentions a “static analyzer” for finding bugs in your app called FindBugs. I haven’t used this tool before, but I would definitely consider it now that I’ve read this chapter.

Chapter 6: Effective Java for Android

The most interesting part of this chapter is the discussion on concurrency / threads in Android. Rule #1 of Android development is to not perform long-running operations in the UI thread unless you want your users to get Application Not Responding errors, which are Very Bad. So this chapter discusses how you can use AsyncTasks to perform “slow” operations on a new thread so as not to block the UI thread. There’s also some discussion of serialization and Parcelables in this chapter, which are important concepts to master in Android. However, it did seem a little odd to me that concurrency and serialization would be in the same chapter here.

Chapter 7: Building a View

We’re seven chapters into this book and we’re just now discussing Views and how they’re used to design our app’s user interface. Interesting! It seems to me that this chapter should have come up a LOT sooner. Either way, there’s some discussion of how Views are laid out, especially with the LinearLayout. What I found odd about this chapter is that despite being called “Building a View”, the main flow of the chapter is about Android’s MVC architecture, which is a good way to think about programming in Android, but 2/3 of the chapter has nothing to do with Views. The last part of the chapter shows how to create a Menu for your users. I’m torn on whether or not this should be here considering that Menus are deprecated in Android 3.0 and later.

Chapter 8: Fragments and Multiplatform Support

I’m not sure what this chapter has to do with multiplatform support, because it seems to be entirely about fragments. I’m not too thrilled to see this chapter here – fragments are a relatively advanced UI concept, and we’re learning about it right after we learned how to use Views and event callbacks? Plus, this chapter is really short and I feel like fragments deserve a lot more explanation than given here.

Chapter 9: Drawing 2D and 3D Graphics

I have some mixed feelings on this chapter. The focus of this chapter seems to be describing some of the lower-level things you can do in Android to draw 2D and 3D graphics, especially if you are creating your own widgets / UI components. There’s also some explanation of matrix transformations, effects, and animations you can apply to your Views. There’s also a brief introduction to using OpenGL in Android.

While I was amused to see that you can do all of these transformations and effects in Android, it seems unlikely that most new Android developers would jump right in to creating their own UI components, so I’m not sure why this chapter wasn’t an advanced topic.

Chapter 10: Handling and Persisting Data

The focus of this chapter is mainly how to use Android’s built-in support for SQLite in order to persist and retrieve your application’s data in a relational database. Now we’re talking! Unlike some of the previous chapters, I believe this is something every new Android dev should learn as soon as possible. My only possible complaint about this chapter is that the Shared Preferences Database isn’t even mentioned as a possible way to store very simple app data, but I can overlook that considering that SQLite is a much more scalable solution for persisting data.

Chapter 11: A Framework for a Well-Behaved Application

I’m not sure why this chapter is called what it is, because this chapter is all about an activity or fragment’s lifecycle, as well as how to save and restore state correctly during the lifecycle. There’s also some interesting content on task behavior (and how tasks are launched), though I’m not sure if the intent flags are explained in a way that really makes sense. Still, not a bad chapter aside from its name =)

Chapter 12: Using Content Providers

This is one of the chapters I was most looking forward to when reading this book, because I haven’t had a lot of previous experience working with (or creating my own) content providers. This chapter explains how they work and constructs an example of how they could be used in a small sample application. Overall this chapter is interesting and easy enough to follow.

Chapter 13: Exploring Content Providers

This chapter is a bit like a continuation of the last chapter, where the authors use the previously implemented content provider to create a full application to search and display YouTube videos. Unfortunately, this chapter shows why books aren’t always the best medium for teaching; it’s full of source listings spanning multiple pages and with little contextual glue between them. I found myself wishing that I could find the source for this example online somewhere and just look through the code myself rather than trying to read and digest the source code. Trying to read the source and understand the explanations ultimately proved futile, so despite my best efforts I gave up on finishing the chapter and moved on. I really think this book would have been better if the source had been available online.

Chapters 14-16: Multimedia / Location / Sensors / Speech / Accessibility / Etc

These chapters are considered “advanced topics”, such as playing/recording video or audio on Android, location and mapping, sensors, near-field communications, speech, gestures, accessibility, etc. While these topics are interesting, they also seem to be covered pretty well already on the Android Dev Guide.

Chapter 17: Communication, Identity, Sync, and Social Media

This chapter marries two very different things; the first being an example of how your app could sync contact data with a remote service, the second being using Bluetooth in your app. Why these two topics are in the same chapter is beyond me, but since the former doesn’t seem to be easily discoverable in the Android Dev Guide, it made the chapter worth reading.

Chapter 18: The Android Native Development Kit

This might be one of my favorite chapters in the book. The Android Dev Guide doesn’t really cover the NDK in a long-form topic – it’s mostly just a brief explanation and an offer to download it and play with sample applications. Fair enough, but how are developers supposed to know if the NDK is worth playing with in the first place? This chapter explains what it’s for and how to use it in a way that is concise and easy to read.

Closing Thoughts

I thought that this book was a decent introduction to the Android platform, but the way that the information is split into chapters makes almost no sense. Some topics are too advanced to be covered in early chapters; other chapters feature multiple concepts that have no discernible relation to each other. If there was one thing I would recommend to the authors, it would be to come up with a more logical, linear progression from basic Android topics to advanced ones.

The other main problem with this book is much deeper. In a vacuum, I think this book has inherent value in what in can teach about the Android platform, but it must be compared against the available alternatives. One such alternative is the Android Dev Guide itself, which is free. So the real question is, does this book contain $27 worth of content that you cannot get from reading the Android Dev Guide? Unfortunately I think the answer is no. The Dev Guide is always up to date, contains more information than this book does, and you won’t find yourself struggling to make it through chapter 13. If you prefer reading books to reading websites, or can’t access the internet, or you have about $27 more than you know what to do with, then buy this book. Otherwise, just read the Dev Guide.

Published by


Seattleite. Climber. Snowboarder. Traveler. Party rocker. Technologist. Spanish enthusiast. Fun-seeker.

One thought on “Book Review: Programming Android”

  1. This is one of the best Android book which I get to see so far. It could be better structured but still not a book to let it go. this book is a work of experienced developers.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s