自己做了一个launcher,通过系统widget选择器选择了模拟时钟添加在launcher中,每当时间有变化时launcher都会崩溃:
crash log如下:
其中com.mylauncher.allappsview.allappslaunchermodel是我的数据缓存类
03-25 10:00:00.135: E/AndroidRuntime(10161): FATAL EXCEPTION: com.mylauncher.allappsview.allappslaunchermodel
03-25 10:00:00.135: E/AndroidRuntime(10161):java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.TIME_TICK flg=0x40000014 (has extras) } in android.widget.AnalogClock$1@416b2750
03-25 10:00:00.135: E/AndroidRuntime(10161): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:768)
03-25 10:00:00.135: E/AndroidRuntime(10161): at android.os.Handler.handleCallback(Handler.java:725)
03-25 10:00:00.135: E/AndroidRuntime(10161): at android.os.Handler.dispatchMessage(Handler.java:92)
03-25 10:00:00.135: E/AndroidRuntime(10161): at android.os.Looper.loop(Looper.java:137)
03-25 10:00:00.135: E/AndroidRuntime(10161): at android.os.HandlerThread.run(HandlerThread.java:60)
03-25 10:00:00.135: E/AndroidRuntime(10161): Caused by: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
03-25 10:00:00.135: E/AndroidRuntime(10161): at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:4746)
03-25 10:00:00.135: E/AndroidRuntime(10161): at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:854)
03-25 10:00:00.135: E/AndroidRuntime(10161): at android.view.ViewGroup.invalidateChild(ViewGroup.java:4077)
03-25 10:00:00.135: E/AndroidRuntime(10161): at android.view.View.invalidate(View.java:10379)
03-25 10:00:00.135: E/AndroidRuntime(10161): at android.view.View.invalidate(View.java:10334)
03-25 10:00:00.135: E/AndroidRuntime(10161): at android.widget.AnalogClock$1.onReceive(AnalogClock.java:250)
03-25 10:00:00.135: E/AndroidRuntime(10161): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:758)
03-25 10:00:00.135: E/AndroidRuntime(10161): ... 4 more
|