android(32)(任务栈)
来源:互联网 发布:epson l101清零软件 编辑:程序博客网 时间:2024/04/28 03:21
1.布局文件:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".MainActivity" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="我是界面01" android:textSize="30sp" /> <Button android:onClick="open01" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="开启界面01" /> <Button android:onClick="open02" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="开启界面02" /></LinearLayout><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".MainActivity" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="我是界面02" android:textSize="30sp" /> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:onClick="open01" android:text="开启界面01" /> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:onClick="open02" android:text="开启界面02" /></LinearLayout>2.业务逻辑代码:public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); System.out.println("01activity被创建了。任务栈id:"+getTaskId()); } public void open01(View view){ Intent intent = new Intent(this,MainActivity.class); startActivity(intent); } public void open02(View view){ Intent intent = new Intent(this,SecondActivity.class); startActivity(intent); }}public class SecondActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); System.out.println("02activity被创建了。任务栈id:"+getTaskId()); } public void open01(View view){ Intent intent = new Intent(this,MainActivity.class); startActivity(intent); } public void open02(View view){ Intent intent = new Intent(this,SecondActivity.class); startActivity(intent); } @Override protected void onNewIntent(Intent intent) { System.out.println("02activityonnew intnet。任务栈id:"+getTaskId()); super.onNewIntent(intent); }}
0 0
- android(32)(任务栈)
- android任务栈
- Android 任务栈
- android 任务栈分类
- Android任务栈解读
- Android任务栈原理
- Android-Activity任务栈
- Android任务栈简介
- Android activity任务栈
- Android任务栈
- Android Task任务栈
- Android的任务栈
- Android Activity任务栈
- Android task任务栈
- Android任务栈简介
- android 任务和栈 相关
- android 任务栈的管理
- android的task任务栈
- State(状态)设计模式
- php应用webservice
- 欢迎使用CSDN-markdown编辑器
- UVa 10887 - Concatenation of Languages
- 软件工程学概述
- android(32)(任务栈)
- SIP协议过程
- 关于前端和后台服务器协调开发的几点建议
- Android测试教程13--模拟服务器MockServer之Moco详细介绍
- checkbox的checked事件
- mac上抓包数据分析Charles
- 研究生论文
- 【google M】android 网络服务状态运行机制(语音、数据注册状态;运营商信息PLMN,SPN;radio技术;信号强度)
- 2016投资10记