【发布时间】:2012-05-25 11:28:12
【问题描述】:
有没有其他人遇到过手机旋转时应用程序崩溃的经历? 我在三星 Galaxy 2 上运行 Android 4.0.3。
运行 Android 2.3.3 的 HTC 或三星不会出现此问题。
Eclipse 调试屏幕未显示任何错误。
我的应用是使用 PhoneGap 开发的。
旋转手机时记录:
05-25 13:38:09.155: I/GATE(20061): <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
05-25 13:38:09.175: D/DroidGap(20061): Origin to allow: http://127.0.0.1*
05-25 13:38:09.175: I/CordovaLog(20061): Found log level DEBUG
05-25 13:38:09.175: I/CordovaLog(20061): Changing log level to DEBUG(3)
05-25 13:38:09.175: I/CordovaLog(20061): Found preference for classicRender
05-25 13:38:09.175: D/DroidGap(20061): DroidGap.onCreate()
05-25 13:38:09.180: D/DroidGap(20061): DroidGap.loadUrl(file:///android_asset/www/index.html)
05-25 13:38:09.180: D/DroidGap(20061): DroidGap: url=file:///android_asset/www/index.html baseUrl=file:///android_asset/www/
05-25 13:38:09.205: I/webclipboard(20061): clipservice: android.sec.clipboard.ClipboardExManager@4169fae8
05-25 13:38:09.210: D/DroidGap(20061): DroidGap.init()
05-25 13:38:09.260: D/PluginManager(20061): init()
05-25 13:38:09.280: D/WML_SISO(20061): InitPasteboardJni
05-25 13:38:09.280: D/SoftKeyboardDetect(20061): Ignore this event
05-25 13:38:09.730: W/IInputConnectionWrapper(20061): showStatusIcon on inactive InputConnection
05-25 13:38:09.790: I/GATE(20061): <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
05-25 13:38:09.810: I/GATE(20061): <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
【问题讨论】:
-
请发布您的 LogCat 记录。
-
每当屏幕旋转时,它的方向就会改变,所以可能在方向改变的时候你的代码会抛出一些异常,所以应用程序崩溃了,如果是这样很容易找到错误你发送错误日志
-
也许您的后台线程正在运行,并在完成后在 UI 线程上发布一些更改,但方向更改将重新启动活动,并且您之前的 UI 线程已被破坏。