西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 5 Intent

Android Programming Lecture 5 Intent
Android Programming Lecture 5 Intent

What is Intent From Google:An Intent object is a bundle of information. It contains information of interest to the component that receives the intent(such as the action to be taken and the data to act on)plus information of interest to the Android system(such as the category of component that should handle the intent and instructions on how to launch a target activity) 2
What is Intent • From Google: An Intent object is a bundle of information. It contains information of interest to the component that receives the intent (such as the action to be taken and the data to act on) plus information of interest to the Android system (such as the category of component that should handle the intent and instructions on how to launch a target activity) 2

Start an Activity with Intent Explicit Intent Activity 1 Activity 2 Intent Intent anIntent new Intent(Activity1.this,Activity2.class); startActivity(anIntent); Activity 1 Activity 2 Intent Intent AnotherIntent new Intent(Activity2.this,Activity1.class); startActivity(AnotherIntent); 3
Start an Activity with Intent 3 Activity 1 Activity 2 Intent Intent anIntent = new Intent(Activity1.this, Activity2.class); startActivity(anIntent); Intent AnotherIntent = new Intent(Activity2.this, Activity1.class); startActivity(AnotherIntent); Activity 1 Activity 2 Intent Explicit Intent

Activity Stack
Activity Stack 4

Start Activity 2 Start Activity 3 Navigate back Foreground activity Activity 3 Activity 1 Activity 2 Activity 3 Activity 2 Back Stack Activity 1 Activity 2 Activity 1 Activity 1 Activity 3 destroyed The activities are arranged in a stack,called task,in the order in which each activity is opened. When the current activity starts another,the new activity is pushed on the top of the stack and takes focus.The previous activity remains in the stack,but is stopped. Refer to: http://developer.android.com/guide/components/tasks-and-back-stack.html 5
5 • The activities are arranged in a stack, called task, in the order in which each activity is opened. • When the current activity starts another, the new activity is pushed on the top of the stack and takes focus. The previous activity remains in the stack, but is stopped. Refer to: http://developer.android.com/guide/components/tasks-and-back-stack.html

Start Activity 2 Start Activity 3 Navigate back Foreground activity Activity 3 Activity 1 Activity 2 Activity 3 Activity 2 Back Stack Activity 1 Activity 2 Activity 1 Activity 3 Activity 1 destroyed When the user presses the 12:45 Back button,the current activity is popped from the top of the stack and the previous activity resumes Refer to: http://developer.android.com/guide/components/tasks-and-back-stack.html
6 • When the user presses the Back button, the current activity is popped from the top of the stack and the previous activity resumes Refer to: http://developer.android.com/guide/components/tasks-and-back-stack.html

task A User selects to view Activity 2 the second scene User get back to Main Menu the main menu User selects to view the first scene Activity 1 Separate instance User launches Main Menu the app A single activity is instantiated multiple times
7 A single activity is instantiated multiple times. Main Menu Activity 1 Main Menu Activity 2 Separate instance task User launches the app User selects to view the first scene User get back to the main menu User selects to view the second scene

Launch Modes of Activity The launchMode attribute specifies an instruction on how the activity should be launched into a task There are four different launch modes you can assign to the launchMode attribute o standard:(the default mode) o singleTop:Reuse the activity on the top o singleTask:The system creates a new task and instantiates the activity at the root of the new task. o singleInstance Refer to: http://developer.android.com/quide/components/tasks-and-back-stack.html http://inthecheesefactory.com/blog/understand-android-activity-launchmode/en 8
Launch Modes of Activity • The launchMode attribute specifies an instruction on how the activity should be launched into a task • There are four different launch modes you can assign to the launchMode attribute o standard: (the default mode) o singleTop: Reuse the activity on the top o singleTask:The system creates a new task and instantiates the activity at the root of the new task. o singleInstance 8 Refer to: http://developer.android.com/guide/components/tasks-and-back-stack.html http://inthecheesefactory.com/blog/understand-android-activity-launchmode/en

Launch Modes of Activity http://ww.intridea.com/blog/2011/6/16/android-understanding-activity-launchmode 9
Launch Modes of Activity 9 http://www.intridea.com/blog/2011/6/16/android-understanding-activity-launchmode

Pass Data using Intent 10
Pass Data using Intent 10
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 4 Activity, Intent and UI.pptx
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 3 File structure and Layout.pptx
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 2 Introduction to Java and Object Oriented Programming.pptx
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 1 Introduction to Network Computing(主讲:栾浩).pptx
- 《算法基础》课程教学资源(学习笔记)算法基础 课堂笔记.pdf
- 长沙理工大学:《微机原理与接口技术》课程教学资源(大纲教案)微机原理与应用授课教案(负责人:叶青,打印版).pdf
- 同济大学:《逻辑网络》课程电子教案(PPT课件)数字设计中的基本电路 Introduction to the circuits in digital design.ppt
- 同济大学:《逻辑网络》课程电子教案(PPT课件)异步时序电路分析与设计 Introduction to asynchronous circuits design.ppt
- 同济大学:《逻辑网络》课程电子教案(PPT课件)寄存器与计数器 register and counters.ppt
- 同济大学:《逻辑网络》课程电子教案(PPT课件)同步时序电路设计中的问题 Advanced design issue.ppt
- 同济大学:《逻辑网络》课程教学资源(试卷习题)考试样卷.doc
- 同济大学:《逻辑网络》课程教学资源(教学大纲)逻辑网络(英文)Logic networks.doc
- 同济大学:《逻辑网络》课程教学资源(教学大纲)逻辑网络(中文,负责人:周俊鹤).doc
- 北京化工大学:《数据结构》课程PPT教学课件(C语言描述)第六章 查找.ppt
- 北京化工大学:《数据结构》课程PPT教学课件(C语言描述)第五章 图.ppt
- 北京化工大学:《数据结构》课程PPT教学课件(C语言描述)第三章 栈和队列.ppt
- 北京化工大学:《数据结构》课程PPT教学课件(C语言描述)第二章 线性表.ppt
- 北京化工大学:《数据结构》课程PPT教学课件(C语言描述)第一章 绪论(负责人:侯虹).ppt
- 北京化工大学:《大学计算机基础》课程电子教案(PPT教学课件)第7章 多媒体技术基础.ppt
- 北京化工大学:《大学计算机基础》课程电子教案(PPT教学课件)第6章 数据库基础.ppt
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 6 List View and Custom View.pptx
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 7 Data Persistence.pptx
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 8 Multi-threading.pptx
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 9 Service and Broadcast Receiver.pptx
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 10 Multimedia.pptx
- 同济大学:《软件测试》课程电子教案(PPT课件)Chapter 01 Soft Testing - Fundamentals of Testing.pptx
- 同济大学:《软件测试》课程电子教案(PPT课件)Chapter 02 Testing throughout the Software Lifecycle.pptx
- 同济大学:《软件测试》课程电子教案(PPT课件)Chapter 03 Static Techniques.pptx
- 同济大学:《软件测试》课程电子教案(PPT课件)Chapter 04 Test Design Techniques.pptx
- 同济大学:《软件测试》课程电子教案(PPT课件)Chapter 05 Test Management.pptx
- 同济大学:《软件测试》课程电子教案(PPT课件)Chapter 06 Tool Support for Testing.pptx
- 同济大学:《软件测试》课程电子教案(PPT课件)How To Do High Quality Research, Write Acceptable Papers, and Make Effective Presentations?.ppt
- 《软件测试》课程电子教案(参考资料)Standard glossary of terms used in Software Testing(Version 2.0).pdf
- 《软件测试》课程电子教案(参考资料)Certified Tester Foundation Level Syllabus Released(Version 2011).pdf
- 《软件测试》课程电子教案(参考资料)Certified Tester Foundation Level Syllabus Released(Version 2011).pdf
- 河南科技大学:信息工程学院教育技术学专业本科课程教学大纲(汇编).pdf
- 吉林大学:《人工智能》课程电子教案(PPT课件)第一章 绪论 Artificial Intelligence(AI).ppt
- 吉林大学:《人工智能》课程电子教案(PPT课件)第七章 机器学习.ppt
- 吉林大学:《人工智能》课程电子教案(PPT课件)第三章 知识与知识表示.ppt
- 吉林大学:《人工智能》课程电子教案(PPT课件)第二章 人工智能的数学基础.ppt