任何人都知道,可当我从活动启动服务的原因,仿真器显示消息活动不响应?
在我的服务,我开始2个线程,以便使一些任务。可能是这个问题的原因是什么?
感谢
解决方案任何人知道什么可能是原因 当我从开始服务 活动中,仿真器显示消息 活动不响应?
由于东西在你的应用程序 - 活动,服务等 - 被占用主应用程序线程
在我的服务,我开始2线程 订制一些任务。可这样一 这个问题的原因是什么?
不是直接的,没有,但你真的应该考虑使用的AsyncTask
,而不是分叉你自己的线程
这样的主应用程序线程上长时间运行工作,或用睡眠()
或忙环绑起来,将导致此异常。
anybody knows what can be the reason for when i start a service from an Activity, the emulator shows a message "the activity is not responding?"
![iOS 平板与 Android 平板的交互与动画](https://p.xsw88.cn/allimgs/daicuo/20230907/6333.png)
Inside my Service i start 2 threads in order to make some tasks. can be this the cause of the problem?
Thanks
解决方案anybody knows what can be the reason for when i start a service from an Activity, the emulator shows a message "the activity is not responding?"
Because something in your application -- the activity, the service, etc. -- is tying up the main application thread.
Inside my Service i start 2 threads in order to make some tasks. can be this the cause of the problem?
Not directly, no, though you really should consider using AsyncTask
rather than forking your own threads
Doing long-running work on the main application thread, or tying it up with a sleep()
or busy-loop, will cause this exception.
相关推荐
最新文章