title: One activity, two views. How and where do I inflate the second view?
body: <p>I have an activity that can show two different layouts. Both of the layouts are pre-defined (XML). Basically, if a condition is met, then layout A should be displayed. If the condition fails, then layout B should be displayed.</p>
  
  <p>Layout A is a simplistic Linear Layout - it's my main "form", so to speak.
  Layout B is a simplistic Relative Layout - it's a placeholder until some data can be downloaded. Once the data is downloaded (and a notification is sent), then I want to remove Layout B and display Layout A.</p>
  
  <p>I've tried calling the <code>invalidate()</code> method on Layout B in the <code>onResume()</code> method of my <code>Activity</code> but that doesn't work.</p>
  
  <p>I'm not sure what approach I should take, in (1) where to "correctly" switch the layouts, and (2) how I should go about displaying it. I'm assuming I need to inflate Layout A when my condition is met, but I'm not 100% sure about that.</p>
  
  <p>Edit:
  Snipped of my <code>onCreate()</code> method:</p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.layoutA); // will happen 99% of the time
      ...
      if (!dbHelper.tableIsPopulated()) {
          setContentView(R.layout.layoutB); // show placeholder bc no data exists
          getData();
      }
  }
  </code></pre>