西安电子科技大学:《Mobile Programming》课程PPT教学课件(Android Programming)Lecture 04 Activity, Intent and UI

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

package com. example. editgreeting: import android app. Activity;l Superclass public class MainActivity extends Activity EditText e; TextView t: Button b protected void onCreate(Bundle savedInstancestate)t super onCreate (savedInstancestate) setContentView(R layout activity main); e =(EditTextfindviewById(rid. myEdit Text) (TextView)findviewById(r id my Textview) b = Button)findViewById(R id my Button), Constructor b. setonClickListener (new MyButtononClickListener() class My ButtonOnClickListener implements pnClickListene @Override Interface Inner class public void onclick(View v)i // 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
RoadMap and Learning Objectives • Learn to use the basic UI widgets • Learn to switch Activities using Explicit Intent 3

Ul Development
UI Development 4

Basic Input Controls Input controls are used Button to take data from user Wic idgets Text field OFF Textview a Button Check Box Textview Large Medium Small RadioButton Button Smal OFF ˇ CheckBox, RadioButton a Spinner CheckedTextview Spinner o Text fields Dialogs 5
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 Text Fields have different types like Firstname Lastname Plain Text e Text Field o Person Name 55530100 o Password PAssword Password(Numeric) o email Lorem ipsum dolor sit met consectetur o Phone I Postal Address do esmod tempor o Postal Address 1200am 2011 o multiline text 工 Number Number(Signed) o Time I Number(Decimal) Auto CompleteTextView o Date Multi AutoCompleteTexctView MultiAutoComplete o Number(signed/Unsigned All of the Text Fields mentioned above are merely attributes of edit text http://developer.androidcom/guide/topics/ui/controls/text.html 6
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 a7:51 ol Edit Greeting o EditText. Button are direct subclasses of Hello World Textview Textview doesn 't allow editing in itself It works more like a label Click mel http://developer.androidcom/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 o Image Button(Image Button o Toggle Buttons(ToggleButton) ATTENDING? o Radio Buttons(radioButton) O Maybe ON All buttons have different classes and XML tags to represent them unlike the Text Fields(that had only one tag i.e. Edit Text) http://developer.androidcom/guide/topics/ui/controls/button.html 8
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

Pageview Image View is used to display an image Practises 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

6 Packages O com. exampl p□util Rjava co ActivityA Sb Activity B So ActivityC ta BuildConfig R java: hook the resources and java by b a drawable-hdpi b a drawable-ldpi □ drawable-mdpi providing each resource item an ID o drawable-xhdpi b a layout Ovals 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) : 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 10
• 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每日次数-->可用次数-->下载券;
- 中国科学技术大学:《网络信息安全 NETWORK SECURITY》课程教学资源(PPT课件讲稿)第九章 网络攻击.ppt
- 《面向对象建模技术》课程教学资源(PPT课件讲稿)第11章 UML与RUP.ppt
- 上海交通大学:IT项目管理(PPT讲稿)讲座5 目标、范围管理与需求工程.ppt
- 南京大学:《面向对象技术 OOT》课程教学资源(PPT课件讲稿)设计模式 Design Patterns(1).ppt
- 《算法分析与设计》课程教学资源(PPT课件讲稿)第六章 基本检索与周游方法(一般方法).ppt
- 《面向对象技术》课程教学大纲 Technology of Object-Oriented Programming.doc
- 厦门大学:Web技术(PPT课件讲稿)网站快速开发 & Web前端技术.ppt
- 机械工业出版社:国家“十一五”规划教材《数据库原理与应用教程》教学资源(PPT课件,第3版)第4章 数据操作.ppt
- 《高级语言程序设计》课程教学资源(试卷习题)试题二(无答案).doc
- 《Photoshop教程》教学资源(PPT课件)第6章 Photoshop的绘图工具.ppt
- 《计算机网络》课程教学大纲 Computer Networks.pdf
- 《VB程序设计》课程教学资源(PPT课件讲稿)第二章 VB语言基础.ppt
- 西安电子科技大学:《现代密码学》课程教学资源(PPT课件讲稿)第一章 绪论(主讲:董庆宽).pptx
- 可信计算 Trusted Computing(PPT讲稿)TSS - TCG Software Stack.ppt
- 《Web网站设计与开发》课程教学资源(PPT课件讲稿)第10章 Java Web实用开发技术.ppt
- 电子科技大学:《计算机操作系统》课程教学资源(PPT课件讲稿)第二章 进程与调度 Processes and Scheduling.ppt
- 西安交通大学:《物联网技术导论》课程教学资源(PPT课件)第一章 物联网技术概论(主讲:桂小林).ppt
- 《计算机网络教程》课程PPT教学课件(第三版)第3章 网络体系结构与网络协议.ppt
- 《C语言程序设计》课程教学资源(PPT课件讲稿)第9章 用户自己建立数据类型.pptx
- 《The C++ Programming Language》课程教学资源(PPT课件讲稿)Lecture 07 Exception Handling.ppt
- 对外经济贸易大学:《电子商务概论 Electronic Commerce》课程教学资源(PPT课件讲稿)第八章 电子支付与网络银行.pptx
- 《计算机组装与维护》课程教学资源(PPT讲稿)第九章 计算机软件维护.ppt
- 《计算机组装与维护》课程教学资源(PPT课件讲稿)第16章 常见计算机故障解决案例.ppt
- 《单片机原理及接口技术》课程教学资源(PPT课件)第7章 AT89C51单片机系统扩展 7.4 数据存储器的扩展 7.5 I/O口的扩展.ppt
- 香港城市大学:Adaptive Random Test Case Prioritization(PPT讲稿).pptx
- 哈尔滨工业大学:词义消歧(PPT讲稿)Word sense disambiguation.ppt
- 大连工业大学:《数据结构》课程教学资源(PPT课件讲稿,共十章,路莹).pps
- 清华大学出版社:《计算机网络安全与应用技术》课程教学资源(PPT课件讲稿)第6章 黑客原理与防范措施.ppt
- 中国科学技术大学:《信息论与编码技术》课程教学资源(PPT课件讲稿)第2章 离散信源及其信息测度.pptx
- 《数字图像处理》课程教学资源(PPT课件)第七章 图像分割.ppt
- Detecting Evasion Attack at High Speed without Reassembly.ppt
- 南京大学:《面向对象技术 OOT》课程教学资源(PPT课件讲稿)类和对象 Class and Object.ppt
- 《数字图像处理》课程教学资源(PPT课件)第五章 代数运算.ppt
- 《高级语言程序设计》课程教学资源(试卷习题)试题三(无答案).doc
- 东南大学:《操作系统概念 Operating System Concepts》课程教学资源(PPT课件讲稿)08 Main Memory(主讲:张柏礼).ppt
- 中国科学技术大学:《高级操作系统 Advanced Operating System》课程教学资源(PPT课件讲稿)第四章 分布式进程和处理机管理.ppt
- Network Alignment(PPT讲稿)Treating Networks as Wireless Interference Channel.pptx
- 虚拟存储(PPT课件讲稿)Virtual Memory.ppt
- 《计算机组成原理》课程教学资源(PPT课件讲稿)第二章 电子计算机中信息的表示及其运算.ppt
- 中国科学技术大学:《算法设计与分析》课程教学资源(PPT课件讲稿)第一部分 概率算法(黄刘生).ppt