如何在方向更改时处理ProgressDialog?

时间:2012-08-14 11:56:11

标签: android exception progressdialog

  

可能重复:
  How to deal with orientation change with a ProgressDialog showing?

08-14 17:23:31.078: E/AndroidRuntime(25099): FATAL EXCEPTION: main
08-14 17:23:31.078: E/AndroidRuntime(25099): java.lang.IllegalArgumentException: View not attached to window manager
08-14 17:23:31.078: E/AndroidRuntime(25099):    at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:378)
08-14 17:23:31.078: E/AndroidRuntime(25099):    at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:223)
08-14 17:23:31.078: E/AndroidRuntime(25099):    at android.view.Window$LocalWindowManager.removeView(Window.java:432)
08-14 17:23:31.078: E/AndroidRuntime(25099):    at android.app.Dialog.dismissDialog(Dialog.java:278)
08-14 17:23:31.078: E/AndroidRuntime(25099):    at android.app.Dialog.access$000(Dialog.java:71)
08-14 17:23:31.078: E/AndroidRuntime(25099):    at android.app.Dialog$1.run(Dialog.java:111)
08-14 17:23:31.078: E/AndroidRuntime(25099):    at android.app.Dialog.dismiss(Dialog.java:268)
08-14 17:23:31.078: E/AndroidRuntime(25099):    at android.app.Dialog.cancel(Dialog.java:951)

以上是我在显示进度对话框时旋转屏幕时所获得的内容。 我怎么能处理这个问题...

2 个答案:

答案 0 :(得分:1)

try this one

 <activity android:label="@string/app_name" 
    android:configChanges="orientation|keyboardHidden" 
    android:name=".your.package">

答案 1 :(得分:0)

请在 menifest

中将此行插入您的活动
 <activity
            android:name="your activity" android:configChanges="keyboardHidden|orientation"
          />