title: Android: dynamically creating controls and orientation change
body: <p>Currently I am working on an Android application that is dynamically creating controls.  Everytime a user would click a button a new EditText appears below the button and the user can interact with the EditText.  However if the screen orientation changes, the EditText's that the user created also disappears.  </p>
  
  <p>Code sample of user creating a EditText: (located in a onClick(), p is basic layoutParamas, and layout is a LinearLayout located undearneath the button)</p>
  
  <pre><code>    EditText editText = new EditText(this);
      layout.addView(buttonView, p);
  </code></pre>
  
  <p>Wondering what would be the easiest way to save the layout when the screen orientation changes so I do not loose any of the controls, or am I dyanmically creating the controls wrong.</p>
  
  <p>Thanks.</p>
  
  <p>update:  By overriding the onSaveInstanceState() I was able to save a object which contained a list of all the controls the user orignally added.  Using this list I was able to create the controls in the onCreate().</p>
  
  <p>Still curious if there is an easier way to accomplish this task, as I would have to refactor a lot of code to fully implement this method.</p>