I\'m just starting out on android and my java is verry rusty. I can\'t remember ever seeing a function nested in another function like this before. Could somebody explain to
It seems that I wrote that Java code ;). That's from one of my examples in the Manning book Unlocking Android - http://code.google.com/p/unlocking-android/. While the goal of the book was not to cover Java in detail, and rather to focus on Android, I apologize if it caused confusion.
The answers here are spot on, that's intentionally an anon inner class because it not used anywhere else outside of that context.
One note that I would add though, if you are just starting out with Android, I would go with a newer book. Mark Murphy's CommonsWare books are quite good (http://commonsware.com/Android/) and he keeps them very up to date (or maybe look at Unlocking Android Second edition, I am not involved with that, and haven't read it so can't recommend or not, but Manning is working on it and it is available as early access at their site).
It might seem strange for an author to be recommending a book other than his own, but the truth is there are some better ways to do that stuff now on the newer APIs (that was written at 1.0 level, and tested on 1.5 after the fact). Don't get me wrong, that book still has a lot of value (that I am proud of) in terms of overall concepts (life cycle, activities, intents, etc.), but there are better/easier/newer ways to get some specific tasks done.
For example, have a look at AsyncTask (http://android-developers.blogspot.com/2009/05/painless-threading.html) and it will save you a lot of Handler/Message pain.
(I would have commented here, but I can't figure out how to comment rather than "answer," it may be related to not having enough of a rep?)