Is there a way to have the layout change when the user flips device
<p>I have code to set a different layout for portrait and landscape.  Is there a way to change the layout while the activity is running, if the user flips the device?</p>

<p>Code to set layout</p>

<pre><code>void SetView()
{
   int w=getWindowManager().getDefaultDisplay().getWidth();
   int h=getWindowManager().getDefaultDisplay().getHeight();

   if (w&gt;h)
      setContentView(R.layout.mainHor);
   else
      setContentView(R.layout.mainVer);
}
</code></pre>
