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 ...
随机推荐
- vs UNICODE 零散的笔记
string--->CString #ifdef UNICODE#define Tstring wstring#else#define Tstring string#endif 可以这样转换CS ...
- Java中的日期操作
在日志中常用的记录当前时间及程序运行时长的方法: public void inject(Path urlDir) throws Exception { SimpleDateFormat sdf = n ...
- 基于zigbee与tiny4412开发板的环境监测系统
一.开发板环境搭建 1.tiny4412 linux系统的布置 参考博客:http://www.cnblogs.com/luoxiang/p/4186391.html 二.boa服务器的搭建 下载 ...
- Android新建项目手动添加Layout布局
前言: 这是看<第一行代码>学习到的第一章,之前使用Eclipse创建Android项目都是自动生成MainActivity.java文件和layout文件夹下的activity_main ...
- DJANTO之FORM
文档很仔细,但熟悉要慢慢来~~ from django.shortcuts import render from contact.forms import ContactForm from djang ...
- XJOI网上同步训练DAY3 T1
思路:看来我真是思博了,这么简单的题目居然没想到,而且我对复杂度的判定也有点问题.. 首先我们选了一个位置i的b,那一定只对i和以后的位置造成改变,因此我们可以这样看: 我们从前往后选,发现一个位置的 ...
- Keil 中关于C语言编译生成汇编代码函数名规则
在keil 中 C语言的函数有带参数和不带参数之分. 一般的资料里说fun(void)类型的函数不带参数,所以,keil编译器生成的汇编的调用地址(函数名) 为fun.这没有错.事实上,不管C语言的函 ...
- windows下删除Linux
在Windows下删除Linux系统的方法(附修复MBR的工具下载) 我的电脑安装了双系统,Windows和Linux,不过由于Linux在最近一段时间内不会使用,所以我打算删除Linux. 删除 ...
- 深入浅出Node.js (6) - 理解Buffer
6.1 Buffer结构 6.1.1 模块结构 6.1.2 Buffer对象 6.1.3 Buffer内存分配 6.2 Buffer的转换 6.2.1 字符串转Buffer 6.2.2 Buffer转 ...
- javabeans的运用
javabeans的运用 对javabean的使用我开始严重的郁闷,跟着书上说的做,但是总是不成功.后来别人说我是基础不牢靠.我觉得应该从servlet学起然后再加进入JSP学是非常快的,对于JAVA ...