title: Switching between layouts and keeping content displayed
body: <p>In my main layout (mainlayout) I am displaying some text and images which are set dynamically based on the actions of the user. For one particular button click I need to display the contents of another layout (secondlayout). I do this using:</p>
  
  <pre><code> setContentView(R.layout.secondlayout);
  </code></pre>
  
  <p>On the second layout I have another button that I use to return to the main layout, once again using:</p>
  
  <pre><code> setContentView(R.layout.mainlayout);
  </code></pre>
  
  <p>The problem is on displaying the mainlayout again all the text and images I was displaying have now disappeared.</p>
  
  <p>How can I return to the mainlayout and still display the contents I was displaying?</p>