title: Orientation Change - Update UI
body: <p>I use data of the accelerometer in my app. If the device´s angle is changed the screen orientation should change.
  In order to change the orientation I have 2 layouts, one for portrait and one for landscape.</p>
  
  <p>When the orientation changes a function is called that changes the layout with:</p>
  
  <p>setContentView(R.layout.landscape); or setContentView(R.layout.portrait);</p>
  
  <p>This works fine but I have a problem with several UI elements like buttons or ToggleButtons.
  I initialize a onClickListener in the onCreate Method for them and each time the orienation gets changed I initialize a new onClickListener.</p>
  
  <p>Unfortunately I can´t change the state of ToggleButtons anymore.</p>
  
  <p>How can I solve this problem?</p>