Common Android thread bug, and fix
Eric Burke has some excellent Android content out there, including the following: A Simple Android App and a Threading Bug. This bug is actually pretty common, I think. I have seen many apps from the Android Market crash/hang around the screen orientation time, and I have even seen the built in "browser" and "home" applications hang thereabouts too (not sure it's related to this, but it happens). Also, I know I have written the buggy code this article calls out myself (it's easy to do it the wrong way).
Fortunately it's a pretty easy fix, and did I mention the article is excellent? Read it. Well written, good background, clearly lays out the issue and explains every aspect, then shows you how to address the problem - serious props to Mr. Burke. The bottom line is that even if you handle non UI tasks outside of the UI thread as you are supposed to, you still need a handle to whatever is happening so you can clean up in onPause (it's not enough to clean up just Activity state there, you have to have a handle on your threads and stop/start them too).







