For the past few months, I spent some of my off time working as a technical editor/reviewer for an Android book called “Android for Programmers: An App-Driven Approach.” From a reader’s perspective, this is a great book to dive right into Android development because it actually creates an app in each chapter to explain specific concepts. Other books often take the approach of pseudo-code or simplistic examples that demonstrate syntax but don’t really show how code is actually used. Android for Programmers demonstrates each topic with real code.
As a reviewer, I found it interesting to see other people’s approaches, offering just a bit of guidance here and there to follow common/best practices used my most Android developers. In one chapter in particular, you learn how to create a game called SpotOn that makes use of property animation (from Honeycomb) to create moving targets. This is a great use of property animation that not only demonstrates a core feature in Honeycomb, it also shows how easily you can use the SDK to accomplish what would otherwise take a lot more code.
If you’re considering learning Android app development or know the basics but want to broaden your understanding, definitely take a look at Android for Programmers: An App-Driven Approach. (And I don’t earn any royalties; I just love the “real code” approach that this book takes.)
In the Address Book app, you used SimpleCursorAdapter, which has been deprecated. The intellisense help says to instead use LoaderManager with CursorLoader.
I guess it is hard to change the code of an app once you have incorporated it into a printed text. Maybe a note or revision of some sort would be appropriate.
The constructor that is used is deprecated because they added a new one in API level 11 that allows you to pass flags to determine behavior. The constructor that is used was available from the early versions of Android, so it is compatible with virtually every Android device with the negative of performing the queries on the UI thread. I believe the compatibility library includes the updated version of SimpleCursorAdapter though, so you can get the best of both worlds
Sorry, I just noticed that you did not write the book, just reviewed it. As a whole, I think the book is great!
No worries; it’s still helpful to point out anything I may have missed as a technical reviewer. I’m glad you’re enjoying the book though.
Hi Ian
I have started to learn Android and Java. I already had the the development platform set up and I have been using it. So I skipped the setup part in the book. When I brought in one of the books applications, I get the following error message:
[2012-01-26 17:48:15 - Address Book] Android requires compiler compliance level 5.0 or 6.0. Found ’1.7′ instead. Please use Android Tools > Fix Project Properties.
I have jdk1.7.0_01, which I thought was the latest. What do I need to do to fix this?
Thanks
Cliff
Hi Cliff,
Java’s versions are a bit confusing but basically 1.5 is also 5.0, 1.6 is 6.0 and 1.7 is 7.0, so your version is new enough certainly. Chances are Eclipse is defaulting to 1.7/7.0, which is newer than you want. You can try the suggested fix to see if that does it for you by right-clicking on your project and picking Android Tools then Fix Project Properties (it may take a moment to rebuild). If that doesn’t work for you, you can right-click on the project and pick properties, pick Java Compiler on the left hand side and either set project specific settings to 1.6 or go to Configure Workspace Settings and change all projects to 1.6. Hopefully that resolves the problem for you.
- Ian
Hi Ian
Thanks for the information. I have Eclipse set to 1.7. I thought that is was telling me that I had a version that was too old. I’ll try setting it back to an early version and see what happens.
Thanks again for you time
Cliff
Hi ian
I set it to 1.6 and it worked.
Again thanks a bunch.
cliff
I am a php programmer begginng to learn android, Will your book help me??