When the screen orientation changes, the currently-visible
Activity instance is destroyed and re-created, causing local variables of the
Activity instance to be reset to their initial values. The article
Global Variables in Android Apps suggests the solution of placing state data that needs to be "persisted" between instances of the activity in the app's
Application object. The thing is, I don't think that I like this idea because if I program an app with multiple activities, then the
Application object might become littered with variables.
A few days ago I thought about making some fields of the activity class
static. Is this a good idea for storing activity state? Am I guaranteed that at most one instance of any
Activity class will exist at any given time?