zoukankan      html  css  js  c++  java
  • Is the onDestroy method of Activity certain to call?

    The official doc about onDestroy method:
     
    protected void onDestroy ()    
    Added in API level 1  
    Perform any final cleanup before an activity is destroyed. This can happen either because the activity is finishing 
    (someone called finish() on it, or because the system is temporarily destroying this instance of the activity to save 
    space. You can distinguish between these two scenarios with the isFinishing() method.  
    Note: do not count on this method being called as a place for saving data! For example, if an activity is editing data in 
    a content provider, those edits should be committed in either onPause() or onSaveInstanceState(Bundle), not here. This 
    method is usually implemented to free resources like threads that are associated with an activity, so that a destroyed 
    activity does not leave such things around while the rest of its application is still running. There are situations where 
    the system will simply kill the activity's hosting process without calling this method (or any others) in it, so it 
    should not be used to do things that are intended to remain around after the process goes away. 
    Derived classes must call through to the super class's implementation of this method. If they do not, an exception will be thrown.  
  • 相关阅读:
    Python笔记_函数,模块,包的关系
    「GXOI / GZOI2019」宝牌一大堆
    「BalticOI 2020」村庄 (贪心)
    CF Round #635 Div.1 Chiori and Doll Picking (hard version)
    「BalticOI 2020」病毒
    「BalticOI 2020」小丑
    「BalticOI 2020」混合物
    k短路
    「JSOI2019」神经网络
    「NOI2020」时代的眼泪
  • 原文地址:https://www.cnblogs.com/younghome/p/4608982.html
Copyright © 2011-2022 走看看