我的WebView
里面有一个DialogFragment
显示登录页面,用户输入用户名和密码后,提示保存密码,但是如果用户在那一刻旋转手机,WebView
会崩溃,提示将隐藏给用户,因此无法重新输入/重写数据,WebView
在这些功能中被禁用,并且在配置更改后仍然存在的这种特殊情况下DialogFragment
,用户将无法提交数据,即使我再次更改配置,以及另一个问题是,在我重建所有内容之前,内部操作系统不再恢复,例如,我离开了WebView
,当我重新创建它时,直到配置再次更改,键盘才会出现。
崩溃日志如下:
12-24 08:36:21.694: E/WindowManager(21235): Activity com.example.twitterlibraryservice.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@45aef418 that was originally added here
12-24 08:36:21.694: E/WindowManager(21235): android.view.WindowLeaked: Activity com.example.twitterlibraryservice.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@45aef418 that was originally added here
12-24 08:36:21.694: E/WindowManager(21235): at android.view.ViewRoot.<init>(ViewRoot.java:255)
12-24 08:36:21.694: E/WindowManager(21235): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
12-24 08:36:21.694: E/WindowManager(21235): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
12-24 08:36:21.694: E/WindowManager(21235): at android.view.Window$LocalWindowManager.addView(Window.java:424)
12-24 08:36:21.694: E/WindowManager(21235): at android.app.Dialog.show(Dialog.java:241)
12-24 08:36:21.694: E/WindowManager(21235): at android.app.AlertDialog$Builder.show(AlertDialog.java:802)
12-24 08:36:21.694: E/WindowManager(21235): at android.webkit.WebView.onSavePassword(WebView.java:1065)
12-24 08:36:21.694: E/WindowManager(21235): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:431)
12-24 08:36:21.694: E/WindowManager(21235): at android.os.Handler.dispatchMessage(Handler.java:99)
12-24 08:36:21.694: E/WindowManager(21235): at android.os.Looper.loop(Looper.java:143)
12-24 08:36:21.694: E/WindowManager(21235): at android.app.ActivityThread.main(ActivityThread.java:4717)
12-24 08:36:21.694: E/WindowManager(21235): at java.lang.reflect.Method.invokeNative(Native Method)
12-24 08:36:21.694: E/WindowManager(21235): at java.lang.reflect.Method.invoke(Method.java:521)
12-24 08:36:21.694: E/WindowManager(21235): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
12-24 08:36:21.694: E/WindowManager(21235): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
12-24 08:36:21.694: E/WindowManager(21235): at dalvik.system.NativeStart.main(Native Method)
编辑更正了WebView
创建后要求焦点的键盘问题。
mWebView.requestFocus();