简体   繁体   English

onPause()在我的活动中被调用。 然后,当回到顶部时,onResume()永远不会被调用

[英]onPause() gets called on my activity. Then, when brought back to the top, onResume() never gets called

After the onPause() getting called, there are no calls to onStop() nor onDestroy() . 调用onPause()之后,将不再调用onStop()onDestroy() The application is still running, and pid is the same (if I check it using "ps" Linux command). 该应用程序仍在运行,并且pid相同(如果我使用“ ps” Linux命令对其进行检查)。 When the activity gets back on top, there are no calls to onCreate() nor onResume() . 当活动回到顶部时,不会调用onCreate()onResume() The app appears to be hanging. 该应用似乎正在挂起。 And after a while messages in the log appear saying "Activity destroy timeout for ActivityRecord". 不久后,日志中出现消息,提示“ ActivityRecord ActivityActivation超时超时”。 Oh, and it does not all the time. 哦,而且并非一直如此。 I can run it without getting stuck 2-3 times (with onStop() and onDestroy() called after onPause() , and the new activity getting created when it's time to get on top). 我可以运行它而不会被卡住2-3次(在onPause()之后调用onStop()onDestroy() onPause() ,并且在需要到达顶部时创建新的活动)。 But eventually I get the situation described in the title. 但是最终我得到了标题中描述的情况。

Any idea how this could happen? 知道如何发生吗? Many thanks :) 非常感谢 :)

Well, the app was actually hanging in the state "after onPause() called and complete", waiting for a (not properly initialized) mutex while trying to handle an external event. 好吧,该应用实际上挂在“ onPause()被调用并完成之后”的状态,等待(未正确初始化)互斥锁,同时尝试处理外部事件。 The big part of the apps data was destroyed during onPause() , including that mutex. onPause()期间,包括该互斥锁在内的应用程序数据大部分被销毁。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM