title: Android check boxes change text when switched to landscape
body: <p>I have a view in android that shows a number of check boxes. They are all added dynamically and I set a text for each one in part.</p>
  
  <pre><code>public class MainActivity extends Activity {
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          LinearLayout layout = (LinearLayout) findViewById(R.id.layout);
          LayoutInflater inflater = getLayoutInflater();
  
          for (String string : getResources().getStringArray(R.array.string_array)) { 
              LinearLayout searchField = (LinearLayout) inflater.inflate(R.layout.cb, null);
  
              CheckBox checkBox = (CheckBox) searchField.findViewById(R.id.checkBox1);
              checkBox.setText(string);
              layout.addView(searchField, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
          }
      }
  }
  </code></pre>
  
  <p>AS you can see from the code, I have an array of strings and for each of the strings in the array I add an check box. When the view is first shown, all the check boxes have the correct text, but after I rotate the device to landscape or portrait mode, all the check boxes have the same text (from the last check box). Any rotations (to redraw the screen) do not affect the text anymore. All of them remain with the text of the last check box.</p>
  
  <p>I have looked in the debugger, the check box object is a new one for each string, so I am not working with the same instance of an object. I am currently out of ideas.</p>
  
  <p>Do you have any idea why this is happening?</p>