title: setRequestedOrientation before showing ProgressDialog leads to crash
body: <p>I am developing an android app that should only run in portrait mode due to the layout not fitting on a phone's landscape screen.
  On tablets and netbooks, however, I want the app to only run in landscape mode.</p>
  
  <p>I've now tried to check if the app is running on a tablet device and setting the corresponding requested orientation via setRequestedOrientation.</p>
  
  <p>The problem is that the app crashes now when the device is not already held in the orientation I'm requesting, because I display a progressDialog shortly after the call to setRequestedOrientation, which seems to leak a window then.</p>
  
  <p>Logcat says:</p>
  
  <pre><code>10-18 21:15:30.698: E/WindowManager(653): Activity has leaked window  com.android.internal.policy.impl.PhoneWindow$DecorView@41991418 that was originally added here
  10-18 21:15:30.698: E/WindowManager(653): android.view.WindowLeaked: Activity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41991418 that was originally added here
  10-18 21:15:30.698: E/WindowManager(653):   at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:279)
  10-18 21:15:30.698: E/WindowManager(653):   at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:215)
  10-18 21:15:30.698: E/WindowManager(653):   at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:140)
  10-18 21:15:30.698: E/WindowManager(653):   at android.view.Window$LocalWindowManager.addView(Window.java:537)
  10-18 21:15:31.888: E/WindowManager(653): Activity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41588040 that was originally added here
  10-18 21:15:31.888: E/WindowManager(653): android.view.WindowLeaked: Activity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41588040 that was originally added here
  10-18 21:15:31.888: E/WindowManager(653):   at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:279)
  10-18 21:15:31.888: E/WindowManager(653):   at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:215)
  10-18 21:15:31.888: E/WindowManager(653):   at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:140)
  10-18 21:15:31.888: E/WindowManager(653):   at android.view.Window$LocalWindowManager.addView(Window.java:537)
  10-18 21:15:34.168: E/AndroidRuntime(653):  at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:599)
  10-18 21:15:34.168: E/AndroidRuntime(653):  at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:336)
  10-18 21:15:34.168: E/AndroidRuntime(653):  at android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:151)
  </code></pre>
  
  <p>What could I do to prevent this crash?
  Any help would be highly appreciated.</p>
  
  <p>EDIT:
  As I was not able to solve this, I finally managed to edit my Layout so that it now allows usage in portrait and landscape mode.</p>