1. 在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()");
}

  

  1. 在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生命周期、的更多相关文章

  1. 安卓——Activity生命周期

      在xml 设计页面添加标签 xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:a ...

  2. 安卓activity生命周期

    相信不少朋友也已经看过这个流程图了,也基本了解了Activity生命周期的几个过程,我们就来说一说这几个过程. 1.启动Activity:系统会先调用onCreate方法,然后调用onStart方法, ...

  3. 安卓 Activity 生命周期

    创建到销毁的生命周期: onCreate()->onStart()->onResume()->onPause->onStop->onDestroy 启动到前台在到后台的生 ...

  4. 安卓Activity生命周期(转)

    http://www.oschina.net/question/54100_27841 启动:onCreate()->onStart()->onResume 当从Activity界面直接按 ...

  5. 零基础Android学习笔记-02 安卓程序生命周期

    一个安卓程序生命周期会经历7中状态,并不一定是每次都全部经历.Create,Start,ReStart,Pause,Resume,Stop,Destory. 重载方法,用helloWorld程序去体验 ...

  6. [JIT_APP]Activity生命周期相关的7个方法

    先发一张安卓官方文档里面的Activity生命周期图解 下面在对这7个生命周期内相关的方法做一些简单的介绍 OnCreate() 当Activity被创建的时候,会自动运行该方法.该方法做一些初始化动 ...

  7. [转]: 两分钟彻底让你明白Android Activity生命周期(图文)!

    转自:http://blog.csdn.net/android_tutor/article/details/5772285 大家好,今天给大家详解一下Android中Activity的生命周期,我在前 ...

  8. Activity生命周期(深入理解)

    今天看到一篇大神总结Activity的文章,内容甚为详细,特此转载http://www.cnblogs.com/lwbqqyumidi/p/3769113.html Android官方文档和其他不少资 ...

  9. Android Activity生命周期

    从android api文档摘抄出来的activity生命周期图如下: Activity有如下四种状态 a.活动状态  activity处于屏幕前台,获取到了焦点可以和用户进行交互,同一时刻只有一个a ...

随机推荐

  1. position relative top失效的问题,温习下常用两种的居中方式

    因为body和html,默认高度是auto 所以相对于他们作为父元素设置position:relative的top值需要加上body,html{height:100%;} <!DOCTYPE h ...

  2. Docker7之Docker overview

    Docker is an open platform for developing, shipping, and running applications. Docker enables you to ...

  3. error LNK2019-无法解析的外部符号 _main-该符号在函数 ___tmainCRTStartup 中被引用

    问题分析: 因为Win32 console Application的入口函数是Main(),而Win32 Application的入口函数才是WinMain() 解决方案: 右键项目,打开[属性]页, ...

  4. 项目Alpha冲刺--4/10

    项目Alpha冲刺--4/10 1.团队信息 团队名称:基于云的胜利冲锋队 成员信息 队员学号 队员姓名 个人博客地址 备注 221500201 孙文慈 https://www.cnblogs.com ...

  5. 深究CSS中Position的属性和特性

    一.position的概念 作为布局必不可缺少的元素之一,深究其属性以及一些注意点是非常必要的. 定义:规定元素的定位类型. position属性: 属性 描述 常用性 absolute 生成绝对定位 ...

  6. 烽火HG220G-U E00L2.03M2000光猫改桥接教程

    烽火HG220G-U E00L2.03M2000光猫改桥接教程 P.S. 此教程同样适用于HG221G/HG260G-U/HG261G.(2016.12) 随着北京联通从原有的ONU升级到HGU之后, ...

  7. Codeforces 765 E. Tree Folding

    题目链接:http://codeforces.com/problemset/problem/765/E $DFS子$树进行$DP$ 大概分以下几种情况: 1.为叶子,直接返回. 2.长度不同的路径长度 ...

  8. python 定时器

    2s启动一个定时器: import threading import time def hello(name): print "hello %s\n" % name global ...

  9. CentOS6.5下搭建VNC服务器

    VNC(Virtual Network Computing,虚拟网络计算机)是一款由AT&T欧洲研究实验室开发的远程控制软件,允许用户在网络的任何地方使用简单的程序来和一个特定的计算机进行交互 ...

  10. [转][osg][QT]osg与QT界面结合的简单例子

    //QT += core gui opengl //LIBS += -losgViewer -losgDB -losgUtil -losg -lOpenThreads -losgGA -losgQt ...