When the user rotates the phone from portrait to horizontal mode, the app is shut down and then restarted. Apps are restarted in a few other situations as well. This topics explains how to preserve data in those situations. See http://www.coreservlets.com/android-tutorial/ for the full tutorial, associated code, exercises, and exercise solutions. You can also download PDF files of each lecture, for saving or printing.