Android Programming Tips
Screen Orientation Change - Saving Focus
Handling screen orientation changes in Android is a pain. However, if you want your application to present a professional user interface, you simply must handle them. Imagine a scenario where the user starts to enter data in a text field on a G1. After a bit of pecking on the virtual keyboard they decide to switch to the built-in keyboard to finish. They switch to the keyboard only to find the cursor is now in a completely different field. Very frustrating. In this article we show you how to maintain the focus and cursor position during a screen orientation change.