I don't know of any books. I learned all I needed just from the SDK documentation, and various blogs with tutorials and how-to's, was more than enough to get me started.
As you've already noticed, certain things are not allowed to be performed on the mainactivity thread. Mainly anything that is likely to have a negative performance impact is not allowed. That's google's way of enforcing good app development that keeps a smooth responsive ui.
For me, I had to figure out how to use threading because I was making some web service calls.
Android actually has a number of different ways of threading. Some are very different, and some are just subtlety different.
You can use asyncTask and Threading, but I found them to be a little frustrating.
Two things I used was the alarmmanager. This is not what it sounds like, it does make sounds and vibrate the phone when it runs. You can trigger any action to happen at a predetermined time, and on a re-occurring basis. This has the added benefit that it once it has been scheduled, it will still run even if your app has been closed. So as an example, this is a good way to check for updates somewhere and generate a system notification.
The other tool you have available is Services and IntentService. This is a quick easy way to run an extra thread if it is just going to be running temporary/minor tasks.
This "work queue processor" pattern is commonly used to offload tasks from an application's main thread. The IntentService class exists to simplify this pattern and take care of the mechanics. To use it, extend IntentService and implement onHandleIntent(Intent). IntentService will receive the Intents, launch a worker thread, and stop the service as appropriate.
All requests are handled on a single worker thread -- they may take as long as necessary (and will not block the application's main loop), but only one request will be processed at a time.
Here's a good page that talks all about that:
http://www.vogella.com/articles/AndroidServices/article.htmlEdited by wedge - 3/16/13 at 9:50am