我有一个应用程序,它在纵向和横向中使用两种布局。为了在初始加载时从 web 加载内容,我使用了 AsyncTask 和进度条。
我检查了这个。由于我有两种布局,这不是解决方案。
下面给出了例外情况。
> 05-08 16:44:43.483: E/WindowManager(20138): Activity com.news.one has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@482b0130 that was originally added here
05-08 16:44:43.483: E/WindowManager(20138): android.view.WindowLeaked: Activity com.news.one has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@482b0130 that was originally added here
05-08 16:44:43.483: E/WindowManager(20138): at android.view.ViewRoot.<init>(ViewRoot.java:247)
05-08 16:44:43.483: E/WindowManager(20138): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:181)
05-08 16:44:43.483: E/WindowManager(20138): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:124)
05-08 16:44:43.483: E/WindowManager(20138): at android.view.Window$LocalWindowManager.addView(Window.java:424)
05-08 16:44:43.483: E/WindowManager(20138): at android.app.Dialog.show(Dialog.java:241)
05-08 16:44:43.483: E/WindowManager(20138): at com.news.one$DownloadNews.onPreExecute(AdaDeranaTabActivity.java:365)
05-08 16:44:43.483: E/WindowManager(20138): at android.os.AsyncTask.execute(AsyncTask.java:391)
05-08 16:44:43.483: E/WindowManager(20138): at com.news.one.onCreate(AdaDeranaTabActivity.java:201)
05-08 16:44:43.483: E/WindowManager(20138): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-08 16:44:43.483: E/WindowManager(20138): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-08 16:44:43.483: E/WindowManager(20138): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-08 16:44:43.483: E/WindowManager(20138): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-08 16:44:43.483: E/WindowManager(20138): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-08 16:44:43.483: E/WindowManager(20138): at android.os.Handler.dispatchMessage(Handler.java:99)
05-08 16:44:43.483: E/WindowManager(20138): at android.os.Looper.loop(Looper.java:123)
05-08 16:44:43.483: E/WindowManager(20138): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-08 16:44:43.483: E/WindowManager(20138): at java.lang.reflect.Method.invokeNative(Native Method)
05-08 16:44:43.483: E/WindowManager(20138): at java.lang.reflect.Method.invoke(Method.java:521)
05-08 16:44:43.483: E/WindowManager(20138): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
05-08 16:44:43.483: E/WindowManager(20138): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
05-08 16:44:43.483: E/WindowManager(20138): at dalvik.system.NativeStart.main(Native Method)
05-08 16:44:54.065: E/AndroidRuntime(20138): FATAL EXCEPTION: main
05-08 16:44:54.065: E/AndroidRuntime(20138): java.lang.IllegalArgumentException: View not attached to window manager
05-08 16:44:54.065: E/AndroidRuntime(20138): at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:388)
05-08 16:44:54.065: E/AndroidRuntime(20138): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:233)
05-08 16:44:54.065: E/AndroidRuntime(20138): at android.view.Window$LocalWindowManager.removeView(Window.java:432)
05-08 16:44:54.065: E/AndroidRuntime(20138): at android.app.Dialog.dismissDialog(Dialog.java:278)
05-08 16:44:54.065: E/AndroidRuntime(20138): at android.app.Dialog.access$000(Dialog.java:71)
05-08 16:44:54.065: E/AndroidRuntime(20138): at android.app.Dialog$1.run(Dialog.java:111)
05-08 16:44:54.065: E/AndroidRuntime(20138): at android.app.Dialog.dismiss(Dialog.java:268)
05-08 16:44:54.065: E/AndroidRuntime(20138): at com.news.one$DownloadNews.onPostExecute(AdaDeranaTabActivity.java:376)
05-08 16:44:54.065: E/AndroidRuntime(20138): at com.news.one$DownloadNews.onPostExecute(AdaDeranaTabActivity.java:1)
05-08 16:44:54.065: E/AndroidRuntime(20138): at android.os.AsyncTask.finish(AsyncTask.java:417)
05-08 16:44:54.065: E/AndroidRuntime(20138): at android.os.AsyncTask.access$300(AsyncTask.java:127)
05-08 16:44:54.065: E/AndroidRuntime(20138): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
05-08 16:44:54.065: E/AndroidRuntime(20138): at android.os.Handler.dispatchMessage(Handler.java:99)
05-08 16:44:54.065: E/AndroidRuntime(20138): at android.os.Looper.loop(Looper.java:123)
05-08 16:44:54.065: E/AndroidRuntime(20138): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-08 16:44:54.065: E/AndroidRuntime(20138): at java.lang.reflect.Method.invokeNative(Native Method)
05-08 16:44:54.065: E/AndroidRuntime(20138): at java.lang.reflect.Method.invoke(Method.java:521)
05-08 16:44:54.065: E/AndroidRuntime(20138): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
05-08 16:44:54.065: E/AndroidRuntime(20138): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
05-08 16:44:54.065: E/AndroidRuntime(20138): at dalvik.system.NativeStart.main(Native Method)
有没有一种方法可以锁定旋转变化,直到应用程序自行加载?
或者和其他想法?
提前致谢。