TheoGB.com
 

Learning to Program Android

This is a blog I plan to add to as I go along.

I've been running using the developer tutorials that Android provide here: http://developer.android.com/training/index.html. As yet they are either due to be brought up to date or they expect anyone trying to learn to program Android to be together enough to deal with the differences between the latest version of Android in Eclipse and what they're implying you'll get.

Lesson 1, Building Your First App, is pretty much impossible to mess up, although there is a small problem with the final step of the four, Create the Second Activity. Here there's reference made to the Action bar setup being in the onCreate method, but in fact it's already been refactored out to a new setupActionBar, which makes the whole thing much neater. I have included the @SuppressLint("NewApi") aspect but I wasn't 100% sure if it was necessary.

Lesson 2, Adding the Action Bar, is incomplete. Not something that the lesson really explains. It starts off by adding in the Action Bar items, something which actually is already in place if you followed Lesson 1 normally, because now all the Action Bar items are included, although the menu is an xml called 'main', if you note carefully, not main_activity_actions.xml, as it claims. The point here is that Lesson 2 adds in references to methods that don't exist (for settings and search) and then goes off about setting the look and feel of your action bar. Certainly, you will probably want to download the Action Bar Icon Pack here: http://developer.android.com/design/downloads/index.html?utm_content=bufferbb942&utm_source=buffer&utm_medium=appdotnet&utm_campaign=Buffer#action-bar-icon-pack.

There is also the question of the missing Theme.Holo and the Theme.Holo.Light options. These were created as part of SDK version 11 or higher, but it seems like just changing the manifest to use 11 doesn't automatically make them appear for you. Ho hum...

If you're going to follow the 2.1 Android support you may be tearing your hair out again. I'll be doing that in a bit...