问题描述
有关的onStop一的onDestroy不能在某些circustances被调用,但我没有找到任何关于与片段相同的Android文档会谈。是的onPause,的onStop,onDestroyView,在销毁onDetach总是叫什么名字?只有在暂停?
Android documentation talks about onStop an onDestroy couldn't be called in some circustances, but i didn't find nothing about the same with fragments. Is onPause, onStop, onDestroyView, on Destroy and onDetach always called? Only on Pause?
推荐答案
这对片段
一样的,所以只有的onPause
总是被调用。
It's the same for Fragments
, so only onPause
is always called.
大多数的回调被称为在同一时间(之前或之后的是准确的)从活动相应的回调
被调用,当片段通过XML布局增加。
Most of these callbacks are called at the same time (before or after to be exact) corresponding callbacks from Activity
are called, when the fragment is added via xml layout.
请注意,在Android的新版本的onStop
也总是被调用。
Note that on newer versions of Android onStop
is also always called.
有关的onStop一的onDestroy不能在某些circustances被称为Android文档会谈
只是要清楚:一些circustances是指你的应用程序由用户或由系统(通常较低时就在后台较长的时间内存或应用程序)被杀害
Just to make it clear: "some circustances" means your application process being killed by the user or by the system (usually when low on memory or application in background for a longer time).
这篇关于Android的碎片生命周期的onStop,onDestroyView,和的onDestroy onDetach的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!