Android生命周期注意事项

onCreate (Bundle savedInstanceState)
finish() from within this function, in which case onDestroy() will be immediately called without any of the rest of the activity lifecycle (onStart(), onResume(), onPause(), etc) executing.onResume ()
onRestoreInstanceState(Bundle), onRestart(), or onPause(), for your activity to start interacting with the user. This is a good place to begin animations, open exclusive-access devices (such as the camera), etc.onWindowFocusChanged(boolean) to know for certain that your activity is visible to the user (for example, to resume a game).MainActivity onStart
MainActivity onResume
MainActivity onWindowFocusChanged hasFocus=true
MainActivity onPause
MainActivity onStop
MainActivity onDestroy
onPause ()
Called as part of the activity lifecycle when an activity is going into the background, but has not (yet) been killed.
When activity B is launched in front of activity A, this callback will be invoked on A. B will not be created until A's onPause() returns, so be sure to not do anything lengthy here.
当Activity要进入后台时触发此方法,但是还没有被杀。
onStop() (after the next activity has been resumed and displayed), however in some cases there will be a direct call back to onResume() without going through the stopped state.onStop ()
Note that this method may never be called, in low memory situations where the system does not have enough memory to keep your activity's process running after its onPause() method is called.
Android生命周期注意事项的更多相关文章
- android 生命周期
引入android生命周期概念来做前端的hash切换页面的思路: 1. page manager来管理多个page(一对多的关系); 2. route:URL <-> Page; 3. P ...
- Android生命周期和Service生命周期
android生命周期 运行:oncreate → onstart → onresume暂停:onresume → onpause:再次运行:onresume停止:onpause → onstop → ...
- Android生命周期里你也许不知道的事
Android生命周期预计连刚開始学习的人都再熟悉只是的东西了,但这里我抛出几个问题.也许大家曾经没有想过或者可能认识的有些错误. 一.当A启动B时,A和B生命周期方法运行的先后顺序是如何的?当按返回 ...
- Android生命周期
Android的生命周期如下图所示: A和B两个Activity,从A启动B活动.执行的方法: A活动 onCreate() onStart() onResume() ...
- Android生命周期详细说明
提供两个关于Activity的生命周期模型图示帮助理解: 图1 图2 从图2所示的Activity生命周期不难看出, ...
- Android 生命周期 和 onWindowFocusChanged
转载 http://blog.csdn.net/pi9nc/article/details/9237031 onWindowFocusChanged重要作用 Activity生命周期中,onStart ...
- Android生命周期回顾
先回顾生命周期 Activity一共有3中状态 运行中 Activity位于前台,并具有用户焦点 暂停 另一个Activity位于屏幕前台并具有用户焦点,但此Activity仍可见.也就是说,另一个A ...
- Android生命周期例子小解
Activity 从创建到进入运行态所触发的事件 onCreate()-->onStart-->onResume() 从运行态到停止态所触发的事件 onPa ...
- Android 生命周期,解决savedInstanceState一直为null的问题
在此之前还是补充下关于监听器的两个要点: 向下一个活动传递数据 : button1.setOnClickListener(new View.OnClickListener() { @Overrid ...
随机推荐
- call()与apply()传参需要注意的一点
call()与apply()是用来改变函数体内的this指向,第一个参数是调用函数的母对象,他是调用上下文,函数体内通过this来获得对它的引用,换句话说就是第一参数===函数中的this. 但是如下 ...
- html label 标签的 for 属性
如果您在 label 元素内点击文本,就会触发此控件.就是说,当用户选择该标签时,浏览器就会自动将焦点转到和标签相关的表单控件上. 有两种使用方法: 方法1 使用for属性 <label for ...
- DOM 其他一些特性
cookie 允许javascript程序读写HTTP cookie 的特殊的属性 domain 允许当Web页面之间交互时,相同域名下相互信任的Web服务器之间协作放宽同源策略安全限制 (JavaS ...
- PHP 读取EXCEL
PHPExcel 自己下载. PHP读取EXCEL public function import_Excel($file_name){ include_once LIB_ROOT_PATH." ...
- Aphache VFS
http://blog.csdn.net/hemingwang0902/article/details/4733911 http://jackyrong.iteye.com/blog/1330946 ...
- activiti任务TASK
一.概要 设计TASK的表主要是:ACT_RU_TASK,ACT_HI_TASKINST(见参考-activiti表): 任务主要有:人工任务(usertask),服务任务(servicetask)等 ...
- java 编码转换
在网络中爬取到的数据,编码可能与当前编译器的编码不相同,而导致可能产生显示乱码的问题.那么如何将网络的编码,转换为当前编译器认可的编码(一般为UTF-8),就是个问题了. 主要使用了两个方法: Str ...
- nodeclub 学习记录
源码地址:https://github.com/cnodejs/nodeclub 按照 它的步骤 在系统中跑没有出错,但是注册后没有发送邮件验证码,我将 controller层下面的sign.js 的 ...
- sort详解
一. 简介 sort命令是帮我们依据不同的数据类型进行排序. 二. 语法 sort [-bcfMnrtk][源文件][-o 输出文件] 补充说明:sort可针对文本文件的内容,以行为单位来排序(默认为 ...
- unix c 06
文件操作 fcntl-> 复制文件描述符/取文件状态/文件锁 文件一系列函数-> access/chmod/truncate/... 目录操作 相关函数:mkdir/rmdir/telld ...