title: Cast XML layout as view in android before setContentView
body: <p>I want to cast multiple XML layouts as views. Because of a change request I need to use a ViewSwitcher. So I have to cast the XML layout to Views before setContentView.</p>
  
  <p>I always get a NullPointerException. I tried:</p>
  
  <p><code>view = (View) findViewById(R.id.viewgroup_id);</code></p>
  
  <p><code>view = (RelativeLayout) findViewById(R.id.viewgroup_id);</code></p>
  
  <p><code>view = (View) findViewById(R.layout.xml_layout);</code></p>
  
  <p><code>view = (View) getResources().getLayout(R.layout.xml_layout);</code></p>