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

Android Programming Lecture 4 Activity,Intent and Ul
Android Programming Lecture 4 Activity, Intent and UI

package com.example.editgreeting; import android.app.Activity; Superclass public class MainActivity extends Activity EditText e; TextView t; Button b; protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstancestate); setContentview(R.layout.activity_main); e =(EditText)findViewById(R.id.myEditText); t (Textview)findViewById(R.id.myTextView); b (Button)findViewById(R.id.myButton); Constructor b.setonclickListener(new MyButtonOnclickListener(); class MyButtonOnclickListener implements onclickListener @Override Interface Inner class public void onclick(View v){ /TODO Auto-generated method stub t.setText(e.getText());
2 Superclass Interface Constructor Inner class

RoadMap and Learning Objectives Learn to use the basic Ul widgets Learn to switch Activities using Explicit Intent 3
RoadMap and Learning Objectives • Learn to use the basic UI widgets • Learn to switch Activities using Explicit Intent 3

UI Development
UI Development 4

Basic Input Controls Input controls are used ▣ Button to take data from user ☑ o Widgets Text field OFF -TextView ON ■Button CheckBox -RadioButton Button Smal o年 CheckBox RadioButton Spinner CheckedTextView Spinner o Text Fields o Dialogs 6
Basic Input Controls • Input controls are used to take data from user o Widgets ▪ TextView ▪ Button ▪ CheckBox ▪ RadioButton ▪ Spinner o Text Fields o Dialogs 5

Text Fields Text Fields allow users to type text in your application. abe Text Fields have different types like: Firstname Lastname o Plain Text 白Form Widgets 321 Text Fields user@domain o Person Name I Plain Text 555)0100 IPerson Name o Password I Password Address I Password(Numeric) o Email IE-mail I Phone Lorem ipsum dolor sit amet consectetur o Phone I Postal Address rMultiline Text o Postal Address 1200am I Time I Date 1/n/2011 o Multiline Text INumber I Number(Signed) o Time 42 I图Number(Decimal) 42.0 o Date a AutoCompleteTextView AutoComplete a:MultiAutoCompleteTextView MultiAutoComplete o Number(Signed/Unsigned) All of the Text Fields mentioned above are merely attributes of EditText http://developer.android.com/guide/topics/ui/controls/text.html
Text Fields • Text Fields allow users to type text in your application. • Text Fields have different types like: o Plain Text o Person Name o Password o Email o Phone o Postal Address o Multiline Text o Time o Date o Number (Signed/Unsigned) • All of the Text Fields mentioned above are merely attributes of EditText 6 http://developer.android.com/guide/topics/ui/controls/text.html

Text View TextView is used to display text on screen. ia751 EditGreeting o EditText,Button are direct subclasses of Hello World TextView. TextView doesn't allow editing in itself It works more like a label Click me! ◆ 与 http://developer.android.com/reference/android/widget/TextView.html 7
Text View • TextView is used to display text on screen. o EditText, Button are direct subclasses of TextView. • TextView doesn't allow editing in itself • It works more like a label 7 http://developer.android.com/reference/android/widget/TextView.html

Buttons Buttons allows user to perform some action. Android have following button types available,sequence is Control Name(Class Name): o Button (Button) Off On o Image Button(ImageButton) o Toggle Buttons (ToggleButton) ATTENDING? o Radio Buttons (RadioButton) OYes OMaybe ONo All buttons have different classes and XML tags to represent them unlike the Text Fields (That had only one tag i.e.EditText) http://developer.android.com/guide/topics/ui/controls/button.html
Buttons • Buttons allows user to perform some action. • Android have following button types available, sequence is Control Name (Class Name): o Button (Button) o Image Button (ImageButton) o Toggle Buttons (ToggleButton) o Radio Buttons (RadioButton) • All buttons have different classes and XML tags to represent them unlike the Text Fields (That had only one tag i.e. EditText) 8 http://developer.android.com/guide/topics/ui/controls/button.html

ImageView ImageView is used to display an image. Practise3 ● Can load images from various BEEN THERE sources,e.g.,drawables/content providers. Various other display options available like scaling tinting. DONE THAT! 9
ImageView • ImageView is used to display an image. • Can load images from various sources, e.g., drawables/content providers. • Various other display options available like scaling & tinting. 9

Packages T□pp com.example.android.lifecycle P回tet 白u R.java ActivityA ©Activity8 ©a ActivityC BuildConfig ©DialogActivity ER R.java:hook the resources and java by P▣drawable--hdpi ▣drawable-ldpi P▣drawable-mdpi providing each resource item an ID 回drawable-xhdpi P▣layout y回values Reference a resource in Java codes Libraries [.]R.. o :name of the package in which the resource is located (not required when referencing resources from your own package). o :resource type. o :the resource filename without the extension or the android:name attribute value in the XML element. findViewById(R.id.***)identify a view on XML by its id ● setContentView(R.layout.***)apply the layout for the content view 0
• Reference a resource in Java codes o : name of the package in which the resource is located (not required when referencing resources from your own package). o : resource type. o : the resource filename without the extension or the android:name attribute value in the XML element. R.java • R.java: hook the resources and java by providing each resource item an ID 10 [.]R.. • findViewById(R.id.***): identify a view on XML by its id • setContentView(R.layout.***): apply the layout for the content view
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 西安电子科技大学:《网络计算》课程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教学课件)第5章 程序设计与软件工程基础.ppt
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 5 Intent.pptx
- 西安电子科技大学:《网络计算》课程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