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. [午间休息] - 午间codewars活跃脑袋

    https://www.codewars.com/kata/51f2b4448cadf20ed0000386/javascript 中午是一个易困的时间段.如果其它人不睡觉还好. 这个js题目就是说如 ...

  2. java.lang.NoClassDefFoundError: com/gexin/rp/sdk/exceptions/RequestException解决方法

    本文为博主原创,未经允许不得转载: 最近在开发个推的时候遇到的问题,当我在maven仓库中下载个推的jar包时,下载不下来,索性在项目中Configue build Path,将jar下载到本地 手动 ...

  3. springcloud问题随笔

    http://www.cnblogs.com/EasonJim/p/8085120.html 1.调用其它服务返回could not be queued for execution and no fa ...

  4. 今天中了一个脚本病毒。把我的所有 html 加了 vbs 脚本,WriteData 是什么鬼?

    今天中了一个脚本病毒.把我的所有 html 加了 vbs 脚本: WriteData 是什么鬼? <SCRIPT Language=VBScript><!-- DropFileNam ...

  5. 5、lvs使用进阶(01)

    四层.七层负载均衡的区别  https://jaminzhang.github.io/lb/L4-L7-Load-Balancer-Difference/   netfilter/iptables简介 ...

  6. mutect/mutsig/gistic官网汇总

    http://software.broadinstitute.org/software/cprg/

  7. 【BZOJ】4008: [HNOI2015]亚瑟王

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=4008 这题主要在于:先算概率,再算期望! 一轮一轮的计算似乎很复杂,每一轮它其实是可以看作 ...

  8. 【三十二】thinkphp之连接数据库、实例化模型

    1.连接数据库 Thinlphp内置了抽象数据库访问层,把不同的数据操作封装起来.我们只需要调用公共的DB类进行操作即可.DB类会自动调用相应的数据库驱动来处理. 在应用目录/common/conf/ ...

  9. L1-033 出生年

    不难,代码: #include <queue> #include <functional> #include <stdio.h> #include <stri ...

  10. React + Ant Design网页,配置

    第一个React + Ant Design网页(一.配置+编写主页) 引用博主的另外一篇VUE2.0+ElementUI教程, 请移步:  https://blog.csdn.net/u0129070 ...