简体   繁体   English

活动和片段之间的生命周期问题

[英]Lifecycle issue between activity and fragment

I encountered a problem on Nexus 9 .(System Version Android marshmallow) On android system before Android marshmallow, fragmentA callback onStop will be called, when activity state containing fragmentA is Stopped. 我在Nexus 9上遇到了一个问题。(系统版本为Android marshmallow)在包含Android棉花糖的Android系统上,当包含FragmentA的活动状态为“已停止”时,fragmentA回调onStop将被调用。 fragmentA callbacks onDestroyView, onDestroy and onDetach will be called when activity state containing fragmentA is Destroyed. 当销毁包含fragmentA的活动状态时,将调用fragmentA回调onDestroyView,onDestroy和onDetach。 The processes was described in official website 有关过程已在官方网站上进行了描述

Recently, I found out that on android marshmallow fragmentA callbacks onStop, onDestroyView, onDestroy and onDetach will be called continuously when activity state containing fragmentA is Stopped. 最近,我发现在Android棉花糖片段上,当包含fragmentA的活动状态已停止时,将连续调用onStop,onDestroyView,onDestroy和onDetach回调。

Sorry, I finally solved this issue. 抱歉,我终于解决了这个问题。 The issue I post was not correct. 我发布的问题不正确。 When activity state is Stopped, fragment callback onStop will be called normally. 当活动状态为“已停止”时,将正常调用片段回调onStop。 There was no problem. 没问题 The issue above was caused by that activity called the onDestroy method when I opened the "Don't keep activities" option in Developer Options. 上面的问题是由在开发人员选项中打开“不保留活动”选项时称为onDestroy方法的活动引起的。 The issue was solved at this . 这个问题在解决了这个

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

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