gpt4 book ai didi

java - Android 版本 2.2 的错误对话框

转载 作者:行者123 更新时间:2023-11-29 23:24:32 29 4
gpt4 key购买 nike

我开发了一个 Android 应用程序。它在 4.4 版本的手机上运行良好,但当我在 2.2 版本的手机上运行它时,它显示以下错误消息。

有人可以帮我解决这个问题吗

   11-21 13:53:14.679: E/WindowManager(29791): Activity com.example.smart_survey.QR has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@406b9460 that was originally added here
11-21 13:53:14.679: E/WindowManager(29791): android.view.WindowLeaked: Activity com.example.smart_survey.QR has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@406b9460 that was originally added here
11-21 13:53:14.679: E/WindowManager(29791): at android.view.ViewRoot.<init>(ViewRoot.java:263)
11-21 13:53:14.679: E/WindowManager(29791): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:171)
11-21 13:53:14.679: E/WindowManager(29791): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:114)
11-21 13:53:14.679: E/WindowManager(29791): at android.view.Window$LocalWindowManager.addView(Window.java:424)
11-21 13:53:14.679: E/WindowManager(29791): at android.app.Dialog.show(Dialog.java:241)
11-21 13:53:14.679: E/WindowManager(29791): at com.example.smart_survey.QR$Logs.onPreExecute(QR.java:362)
11-21 13:53:14.679: E/WindowManager(29791): at android.os.AsyncTask.execute(AsyncTask.java:391)
11-21 13:53:14.679: E/WindowManager(29791): at com.example.smart_survey.QR$UpdateScore.onPostExecute(QR.java:255)
11-21 13:53:14.679: E/WindowManager(29791): at com.example.smart_survey.QR$UpdateScore.onPostExecute(QR.java:1)
11-21 13:53:14.679: E/WindowManager(29791): at android.os.AsyncTask.finish(AsyncTask.java:417)
11-21 13:53:14.679: E/WindowManager(29791): at android.os.AsyncTask.access$300(AsyncTask.java:127)
11-21 13:53:14.679: E/WindowManager(29791): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
11-21 13:53:14.679: E/WindowManager(29791): at android.os.Handler.dispatchMessage(Handler.java:99)
11-21 13:53:14.679: E/WindowManager(29791): at android.os.Looper.loop(Looper.java:130)
11-21 13:53:14.679: E/WindowManager(29791): at android.app.ActivityThread.main(ActivityThread.java:3687)
11-21 13:53:14.679: E/WindowManager(29791): at java.lang.reflect.Method.invokeNative(Native Method)
11-21 13:53:14.679: E/WindowManager(29791): at java.lang.reflect.Method.invoke(Method.java:507)
11-21 13:53:14.679: E/WindowManager(29791): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
11-21 13:53:14.679: E/WindowManager(29791): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)

11-21 13:53:14.773: E/AndroidRuntime(29791): FATAL EXCEPTION: main
11-21 13:53:14.773: E/AndroidRuntime(29791): java.lang.IllegalArgumentException: View not attached to window manager
11-21 13:53:14.773: E/AndroidRuntime(29791): at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:378)
11-21 13:53:14.773: E/AndroidRuntime(29791): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:223)
11-21 13:53:14.773: E/AndroidRuntime(29791): at android.view.Window$LocalWindowManager.removeView(Window.java:432)
11-21 13:53:14.773: E/AndroidRuntime(29791): at android.app.Dialog.dismissDialog(Dialog.java:278)
11-21 13:53:14.773: E/AndroidRuntime(29791): at android.app.Dialog.access$000(Dialog.java:71)
11-21 13:53:14.773: E/AndroidRuntime(29791): at android.app.Dialog$1.run(Dialog.java:111)
11-21 13:53:14.773: E/AndroidRuntime(29791): at android.app.Dialog.dismiss(Dialog.java:268)
11-21 13:53:14.773: E/AndroidRuntime(29791): at com.example.smart_survey.QR$Logs.onPostExecute(QR.java:420)
11-21 13:53:14.773: E/AndroidRuntime(29791): at com.example.smart_survey.QR$Logs.onPostExecute(QR.java:1)
11-21 13:53:14.773: E/AndroidRuntime(29791): at android.os.AsyncTask.finish(AsyncTask.java:417)
11-21 13:53:14.773: E/AndroidRuntime(29791): at android.os.AsyncTask.access$300(AsyncTask.java:127)
11-21 13:53:14.773: E/AndroidRuntime(29791): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
11-21 13:53:14.773: E/AndroidRuntime(29791): at android.os.Handler.dispatchMessage(Handler.java:99)
11-21 13:53:14.773: E/AndroidRuntime(29791): at android.os.Looper.loop(Looper.java:130)
11-21 13:53:14.773: E/AndroidRuntime(29791): at android.app.ActivityThread.main(ActivityThread.java:3687)
11-21 13:53:14.773: E/AndroidRuntime(29791): at java.lang.reflect.Method.invokeNative(Native Method)
11-21 13:53:14.773: E/AndroidRuntime(29791): at java.lang.reflect.Method.invoke(Method.java:507)
11-21 13:53:14.773: E/AndroidRuntime(29791): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
11-21 13:53:14.773: E/AndroidRuntime(29791): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
11-21 13:53:14.773: E/AndroidRuntime(29791): at dalvik.system.NativeStart.main(Native Method)

最佳答案

pDialog = new ProgressDialog(QR.this);
pDialog.setMessage("正在加载,请稍候...");
pDialog.setIn确定(假);
pDialog.setCancelable(false);
将其放在OnCreate方法中,只需在Preexecute中调用pDialog.show()和在PostExecute()中调用pDialog.dismiss()即可,无需更改OnStop()

关于java - Android 版本 2.2 的错误对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27062113/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com