有可能检测是否活动暂停? (线程的问题) [英] It is possible to detect if an activity was paused? (thread problem)
本文介绍了有可能检测是否活动暂停? (线程的问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个对象,它使在一个单独的线程到服务器一些http请求。当返回的响应,我叫听者这让我的活动知道操作结束了。
I have an object which make some http requests in a separate thread to a server. When the response is returned, I call an listener which let my activity know that the operation was finished.
问题是:如果线程运行,该活动被暂停,我得到 android.view.WindowManager $ BadTokenException:无法添加窗口 - 令牌android.os.BinderProxy@4069ef80无效;是您的活动运行?
错误。
The problem is: if the thread is running and the activity was paused I get android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@4069ef80 is not valid; is your activity running?
error.
是否有可能检测是否在活动暂停?谢谢你。
Is it possible to detect if the activity was paused? Thank you.
推荐答案
这篇关于有可能检测是否活动暂停? (线程的问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文