安卓——Activity生命周期、
- 在xml 设计页面添加标签
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.administrator.app_style.MainActivity"
android:orientation="vertical"> <Button
android:id="@+id/b1"
android:text="click select!"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/b2"
android:text="click Dx!"
android:layout_width="match_parent"
android:layout_height="wrap_content" /> </LinearLayout>
2
/**
* Created by Administrator on 2017/1/3.
* 四大组件都需要注册-》跳转
*/
public class One extends AppCompatActivity { // 顺序
// 正常
//
// On create -> 创建 Activity不可见
// On start -> 推出去 Activity可见
// On resume-> 用于暂停的回调Activity
// On pause -> 暂停 Activity
// On stop -> OnDestory 销毁Activity结束
//↓ ↑ ← →
// Log →.d debug .e exception .i info
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.timcopy);
Log.e("s","onCreate ->");
} @Override
protected void onStart() {
super.onStart();
Log.e("s","onStart ->");
} @Override
protected void onResume() {
super.onResume();
Log.e("s","onResume ->");
} @Override
protected void onPause() {
super.onPause();
Log.e("s","onPause ->");
} @Override
protected void onStop() {
super.onStop();
Log.e("s","onStop() ->");
} @Override
protected void onDestroy() {
super.onDestroy();
Log.e("s","onDestroy()");
}
- 在xml 设计页面添加标签
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.administrator.app_style.MainActivity"
android:orientation="vertical"> <Button
android:id="@+id/b1"
android:text="click select!"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/b2"
android:text="click Dx!"
android:layout_width="match_parent"
android:layout_height="wrap_content" /> </LinearLayout>
2
/**
* Created by Administrator on 2017/1/3.
* 四大组件都需要注册-》跳转
*/ public class One extends AppCompatActivity { // 顺序
// 正常
//
// On create -> 创建 Activity不可见
// On start -> 推出去 Activity可见
// On resume-> 用于暂停的回调Activity
// On pause -> 暂停 Activity
// On stop -> OnDestory 销毁Activity结束
//↓ ↑ ← →
// Log →.d debug .e exception .i info @Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.timcopy);
Log.e("s","onCreate ->");
} @Override
protected void onStart() {
super.onStart();
Log.e("s","onStart ->");
} @Override
protected void onResume() {
super.onResume();
Log.e("s","onResume ->");
} @Override
protected void onPause() {
super.onPause();
Log.e("s","onPause ->");
} @Override
protected void onStop() {
super.onStop();
Log.e("s","onStop() ->");
} @Override
protected void onDestroy() {
super.onDestroy();
Log.e("s","onDestroy()");
}
安卓——Activity生命周期、的更多相关文章
- 安卓——Activity生命周期
在xml 设计页面添加标签 xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:a ...
- 安卓activity生命周期
相信不少朋友也已经看过这个流程图了,也基本了解了Activity生命周期的几个过程,我们就来说一说这几个过程. 1.启动Activity:系统会先调用onCreate方法,然后调用onStart方法, ...
- 安卓 Activity 生命周期
创建到销毁的生命周期: onCreate()->onStart()->onResume()->onPause->onStop->onDestroy 启动到前台在到后台的生 ...
- 安卓Activity生命周期(转)
http://www.oschina.net/question/54100_27841 启动:onCreate()->onStart()->onResume 当从Activity界面直接按 ...
- 零基础Android学习笔记-02 安卓程序生命周期
一个安卓程序生命周期会经历7中状态,并不一定是每次都全部经历.Create,Start,ReStart,Pause,Resume,Stop,Destory. 重载方法,用helloWorld程序去体验 ...
- [JIT_APP]Activity生命周期相关的7个方法
先发一张安卓官方文档里面的Activity生命周期图解 下面在对这7个生命周期内相关的方法做一些简单的介绍 OnCreate() 当Activity被创建的时候,会自动运行该方法.该方法做一些初始化动 ...
- [转]: 两分钟彻底让你明白Android Activity生命周期(图文)!
转自:http://blog.csdn.net/android_tutor/article/details/5772285 大家好,今天给大家详解一下Android中Activity的生命周期,我在前 ...
- Activity生命周期(深入理解)
今天看到一篇大神总结Activity的文章,内容甚为详细,特此转载http://www.cnblogs.com/lwbqqyumidi/p/3769113.html Android官方文档和其他不少资 ...
- Android Activity生命周期
从android api文档摘抄出来的activity生命周期图如下: Activity有如下四种状态 a.活动状态 activity处于屏幕前台,获取到了焦点可以和用户进行交互,同一时刻只有一个a ...
随机推荐
- 论文笔记之:Semi-supervised Classification with Graph Convolutional Networks
Semi-supervised Classification with Graph Convolutional Networks 2018-01-16 22:33:36 1. 文章主要思想: 2. ...
- promise对象的使用
ES6中的promise的出现给我们很好的解决了回调地狱的问题,在使用ES5的时候,在多层嵌套回调时,写完的代码层次过多,很难进行维护和二次开发,ES6认识到了这点问题, 现在promise的使用,完 ...
- 【团队】EasyKing的实现_1
完成部分 三个功能类 英雄. 子弹. 瓦片地图. 一个设置类 地图 实现功能 瓦片地图 英雄移动 攻击 受到攻击 TODO 子弹攻击范围 地图.建筑物和英雄的碰撞箱 音效 英雄技能 建筑 双人联机 物 ...
- eclipse创建maven web项目工程步骤示例
参考链接:https://www.cnblogs.com/noteless/p/5213075.html 需求表均同springmvc案例 此处只是使用maven 注意,以下所有需要建立在你的ecli ...
- springboot搭建环境整合jsp页面整合mybatis
1.pom文件依赖 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www ...
- transient关键字详解
作用 1,一旦变量被transient修饰,变量将不再是对象持久化的一部分,该变量内容在序列化后无法获得访问. 2,transient关键字只能修饰变量,而不能修饰方法和类.注意,本地变量是不能被tr ...
- Perl CGI编程
http://www.runoob.com/perl/perl-cgi-programming.html 什么是CGI CGI 目前由NCSA维护,NCSA定义CGI如下: CGI(Common Ga ...
- 提高R语言速度--转载
1. 参考<R语言编程艺术>(Norman Matloff) chapter 14 & chapter 15 2. 方法 (1)向量化 与非向量化-循环做个对比: ...
- RN 实现简易浏览器
import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, View, Dimensions, ...
- Codeforces Round #420 (Div. 2) E. Okabe and El Psy Kongroo 矩阵快速幂优化dp
E. Okabe and El Psy Kongroo time limit per test 2 seconds memory limit per test 256 megabytes input ...