Introduction of three activity modules [onSavedInstanceState()] [onPause()] [onResume()]

迈不过友情╰ 2021-11-17 14:54 266阅读 0赞

onSaveInstanceState() is called by Android if the Activity is being stopped and may be killed before it is resumed! This means it should store any state necessary to re-initialize to the same condition when the Activity is restarted. It is the counterpart to the onCreate()` method, and in fact the `savedInstanceState` Bundle passed in to `onCreate()` is the same Bundle that you construct as `outState` in the `onSaveInstanceState() method.

onPause() and onResume()` are also complimentary methods.onPause()is always called when the Activity ends, even if we instigated that (with afinish()call for example). We will use this to save the current note back to the database. Good practice is to release any resources that can be released during anonPause()as well, to take up less resources when in the passive state.onResume()will call our ```populateFields() method to read the note out of the database again and populate the fields.

ContractedBlock.gif ExpandedBlockStart.gif Comments
populateField() function is used to assign values to EditText controls.you can see more details about it from reference link.

Reference: http://code.google.com/android/intro/tutorial-ex3.html

转载于:https://www.cnblogs.com/EdgarSun/archive/2009/01/09/1372725.html

发表评论

表情:
评论列表 (有 0 条评论,266人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Introduction of Filter in Servlet

       Filter,过滤器,顾名思义,即是对数据等的过滤,预处理过程。为什么要引入过滤器呢?在平常访问网站的时候,有时候发一些敏感的信息,发出后显示时 就会将敏感信息用\等字符