关于onSaveInstanceState的javadoc的渣渣翻译
/**
* Called to retrieve per-instance state from an activity before being
* killed so that the state can be restored in onCreate or
* onRestoreInstanceState (the Bundle populated by this method will be
* passed to both).
* 在被杀死前调用这个方法去处理活动的每个实例状态,可以在OnCreate或者onRestoreInstanceState
* 方法恢复(在这个方法中bundle是比较流行的传递参数的工具)
*
* This method is called before an activity may be killed so that when it
* comes back some time in the future it can restore its state. For example,
* if activity B is launched in front of activity A, and at some point
* activity A is killed to reclaim resources, activity A will have a chance
* to save the current state of its user interface via this method so that
* when the user returns to activity A, the state of the user interface can
* be restored via onCreate or onRestoreInstanceState.
* 在一个活动被杀死的时候,这个方法会被调用,这样当它在未来的时候再次返回可以保存它的状态。例如,如果活动B是在活动A
* 前面启,在一些时候活动A被杀死来回收资源,活动A有机会去保存可以通过这个方法去保存用户界面的当前状态,这样,当用户回到
* 活动A的时候,用户界面的状态可以通过onCreate或者onRestoreInstanceState方法恢复。
*
* Do not confuse this method with activity lifecycle callbacks such as
* onPause, which is always called when an activity is being placed in the
* background or on its way to destruction, or onStop which is called before
* destruction. One example of when onPause and onStop is called and not
* this method is when a user navigates back from activity B to activity A:
* there is no need to call onSaveInstanceState on B because that particular
* instance will never be restored, so the system avoids calling it. An
* example when onPause is called and not onSaveInstanceState is when
* activity B is launched in front of activity A: the system may avoid
* calling onSaveInstanceState on activity A if it isn't killed during the
* lifetime of B since the state of the user interface of A will stay
* intact.
* 不要被活动的生命周期像onPause方法给迷惑,当一个活动是被放置在后台或者它的方法销毁了,或者在被销毁之前OnStop
* 被调用的时候,onPause方法总是会被调用。一个例子就是OnPause和OnStop方法会被调用,当用户导航返回从活动B到
* 活动A就没有这个方法:这里不需要在B调用onSaveInstanceState是因为特定的实例将再也不会恢复了,所以系统避免
* 调用它。一个例子,当onPause被调用而onSaveInstanceState没有调用就是当活动B是启动在A的前面:如果活动
* A在B的生命周期内没有被杀死,系统可能会避免在活动A调用OnSaveInstanceState。因为A的用户界面的状态将会保持
* 完整。
*
* The default implementation takes care of most of the UI per-instance
* state for you by calling android.view.View.onSaveInstanceState() on each
* view in the hierarchy that has an id, and by saving the id of the
* currently focused view (all of which is restored by the default
* implementation of onRestoreInstanceState). If you override this method to
* save additional information not captured by each individual view, you
* will likely want to call through to the default implementation, otherwise
* be prepared to save all of the state of each view yourself.
* 对于大多数UI实例状态的布局的实现来看,需要注意的就是在有一个id的层级的每个布局上调用
* android.view.View.onSaveInstanceState),而且通过保存当前聚焦布局的id(所有的布局会通过onRes
* toreInstanceState方法被恢复)。如果你覆盖这个方法,通过保存额外的信息,而不是通过捕获每个单独的布局的话,
* 你可能想要通过默认的实现调用这个方法,否则可能会准备去保存每个布局、
*
* If called, this method will occur before onStop. There are no guarantees
* about whether it will occur before or after onPause.
* 如果调用,这个方法将会在onStop方法之前被调用。不过这个不保证是否它将在onPause方法之前或者之后
* 被调用
*
* Overrides: onSaveInstanceState(...) in Activity Parameters: outState
* Bundle in which to place your saved state.
*/
关于onSaveInstanceState的javadoc的渣渣翻译的更多相关文章
- 8 种提升 ASP.NET Web API 性能的方法 (转)
出处:http://www.oschina.net/translate/8-ways-improve-asp-net-web-api-performance ASP.NET Web API 是非常棒的 ...
- Android即时通讯开发之XMPP (一)初识XMPP协议和asmack
在讲XMPP和asmck之前 ,我还是先分享一些资源文档,如果你有耐心,可以直接忽略我下面所写的.下面有关XMPP的介绍大部分是摘抄网上的文档,后面我会写一些基于XMPP协议和asmck开源库的聊天室 ...
- android 6.0特性翻译 --渣渣
所有关于Android 6.0 棉花糖的知识 上下文帮助 1.现在按压:不需要离开你正在运行的app或者访问的网站就可 获取帮助,仅仅触摸和按下Home按钮.(长按Home键,可以在 android ...
- 2014年的Google I/O app设计中的材料设计-渣渣的翻译
又是一篇翻译,用了三个多小时.http://android-developers.blogspot.co.id/2014/08/material-design-in-2014-google-io-ap ...
- Python 实现有道翻译命令行版
一.个人需求 由于一直用Linux系统,对于词典的支持特别不好,对于我这英语渣渣的人来说,当看英文文档就一直卡壳,之前用惯了有道词典,感觉很不错,虽然有网页版的但是对于全站英文的网页来说并不支持.索性 ...
- Spring boot 1.3.5 RELEASE 官方文档中文翻译--目录
说明: 打算利用闲暇时候翻译一下Spring boot的官方文档,翻译的版本是1.3.5 RELEASE. 做这件事的目的呢有四: 国内中文的Spring boot资料实在不多,希望能给后来人一点小小 ...
- [技术翻译]Guava-libraries(一): 用户指导
用户指导 本文翻译自http://code.google.com/p/guava-libraries/wiki/GuavaExplained,由十八子将翻译,发表于博客园 http://www.cnb ...
- Activity的onSaveInstanceState()和onRestoreInstanceState()以及API详解
为了弄清楚onSaveInstanceState()方法和onRestoreInstanceState()方法,我翻译一下谷歌的API,翻译如下: There are a few scenarios ...
- Storm官方帮助手册翻译(上)
Storm作为当前最流行的实时计算框架,自Twitter将其开源后就一直备受关注.由于其具有先天的稳定性以及便捷性,目前被许多大公司所采用,国外像雅虎.雅虎日本.Twitter.OOYALA.Spot ...
随机推荐
- Android 再按一次退出程序
实现代码: private long exitTime = 0; /** * 捕捉返回事件按钮 * * 因为此 Activity 继承 TabActivity 用 onKeyDown 无响应,所以改用 ...
- 基于WebForm+EasyUI的业务管理系统形成之旅 -- 构建Web界面(Ⅴ)
上篇<基于WebForm+EasyUI的业务管理系统形成之旅 -- 数据统计>,主要介绍系统数据统计所采用图形.报表工具. 本篇将如何构建Web界面以及新增.编辑.导出数据等功能. 一.在 ...
- HDU2520 我是菜鸟,我怕谁
http://acm.hdu.edu.cn/showproblem.php?pid=2520 我是菜鸟,我怕谁 Time Limit: 2000/1000 MS (Java/Others) Memor ...
- ubuntu14.04安装opencv3.0
sudo apt-get update sudo apt-get upgrade 搭建C/C++编译环境: sudo apt-get install build-essential 安装关联库: su ...
- 【Java基础】Java接口的总结
什么是接口 接口和抽象类很相似,也是一种抽象的概念,用Interface关键字来修饰.那有了抽象类为啥还要有个接口呢,既然都是抽象的,要一个不就可以了吗?其实不是这样的,抽象类是对一类事物共性的一种抽 ...
- HDOJ-ACM1019(JAVA) 多个数的最小公倍数
题意:求多个数的最小公倍数 很简单,但是我一开始的做法,估计会让结果越界(超过int的最大值) import java.util.*; import java.io.*; public class M ...
- KMP学习总结
初学,理解可能不是那么准确~~ Next数组的含义:next[i]表示第0个元素到第i个元素组成的字符串的最大前缀后缀.Next[0]=0显然. 所以KMP的原理就是 通过找出每一阶段最大的相等的前缀 ...
- DevExpress控件XtraGrid的Master-Detail中DetailViewCaption显示问题
今天遇到XtraGrid身档抬头显示不对问题,查找了很多资料后未找到解决办法,后浏览至此文作者发现解决问题的方法就是:DataSet中的RelactionName跟DetailGridview的Lea ...
- 【原】用PHP搭建基于swoole扩展的socket服务(附PHP扩展的安装步骤及Linux/shell在线手册)
最近公司的一项目中,需要用PHP搭建一个socket服务. 本来PHP是不适合做服务的,因为和第三方合作,需要采用高效而稳定的TCP协议进行数据通信.经过多次尝试,最终选择了开源的PHP扩展:swoo ...
- 问题-delphi 调试(F8)错行处理
在delphi 7中(其他版本也可能碰到该问题),编译后,代码左边显示蓝色小点,表示哪句代 码是被编译了的,可今天我的一些代码不能显示那些蓝点了,这样也就不能在上面设断点了,而且用F8跟踪发现执行的顺 ...