How to find out which application has the focus
<p>I want to write an app to turn auto-rotation on and off automatically depending on which application has focus. I currently have an auto-rotation toggle button on the screen for this purpose (I hate autorotation, but find it useful for a small handful of apps), but I often forget to activite it when starting a relevant app, or to deactivate when I'm done with that app (not to mention it is a pain to have to manually toggle it). I haven't been able to figure out how to receive a notification when the focused application changes, which I would need to receive to automate the toggle. Is there any way for to be notified whenever the focus changes?</p>

<p>-Harry</p>
