SlideShare a Scribd company logo
1 of 48
Download to read offline
Android 应用开发 2010 年 8 月 13 日
Android 平台架构 Android 环境配置和开发 Android 应用程序构成 如何开发一个例子 目录
Android 平台架构 JNI JAVA C/ 汇编
简介 ,[object Object],[object Object],[object Object],[object Object],[object Object]
用汉堡比喻 Android  平台架构
目录 Android 环境配置和开发 Android 平台架构 Android 应用程序构成 如何开发一个例子
如何安装  Android SDK  和 Eclipse  插件 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
开发第一个 Android 应用 ,[object Object]
开发第一个 Android 应用
开发第一个 Android 应用 ,[object Object],[object Object]
开发第一个 Android 应用 ,[object Object]
开发第一个 Android 应用 ,[object Object]
Android 应用程序架构 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
目录 Android 环境配置和开发 Android 平台架构 Android 应用程序构成 如何开发一个例子
Android 应用程序构成 Activity Service Broadcast Receiver Content Provider Intent
Activity ,[object Object],[object Object],[object Object],[object Object],[object Object]
Activity 生命周期 ,[object Object],[object Object],[object Object]
Intent ,[object Object],[object Object],[object Object],Intent activity service Broadcast receiver
Intent ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Intent ,[object Object],framework Component name Action Data Category intent component activity service Broadcast receiver
实例 action -- DIAL data -- tel:01038639592 action -- VIEW data -- http://www.google.cn
Service ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Service 生命周期 Context.stopService() Serivce.stopSelf() Context.startService() Context.bindService()
服务 --Service ,[object Object],[object Object],[object Object]
服务 --Service ,[object Object],[object Object],[object Object],[object Object]
服务 --Service ,[object Object]
服务 --Service ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
采用 startService() 启动服务 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
采用 bindService () 启动服务 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
何为 Content provider ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
如何使用 content provider ,[object Object],[object Object],app ContentResolver ContentProvider A ContentProvider B ContentResolver ContentResolver app app
如何使用 content provider ,[object Object],[object Object],[object Object],[object Object],[object Object],delete(Uri url, String where, String[] selectionArgs) insert(Uri url, ContentValues values) query (Uri uri, String[] projection, String selection,  String[] selectionArgs, String sortOrder) update(Uri uri, ContentValues values, String where,  String[] selectionArgs)
定义自己的 content provider
Android 的存储 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Broadcast receiver ,[object Object],[object Object],[object Object],[object Object],[object Object],android app Broadcast receiver Send broadcast
创建 Broadcast Receiver ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],<receiver Android:name=“MyAndroidReceiver&quot;> <Intents-filter> <action Android:name=”com.eoeAndroid.action.NEW_BROADCAST”/> </Intents-filter> </receiver> IntentsFilter filter = new IntentsFilter(NEW_BROADCAST ); MyAndroidReceiver MyAndroidReceiver = new MyAndroidReceiver(); registerReceiver(MyAndroidReceiver , filter);
Broadcast receiver 生命周期 Broadcast receiver 对象在 onReceive 返回后被销毁 onReceive 中不适合处理异步过程。例如弹出对话框与用户交互,可使用消息栏替代。
Android 权限控制 ,[object Object],[object Object],<manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; package=&quot;com.android.app.myapp&quot; > <uses-permission android:name=&quot;android.permission.RECEIVE_SMS&quot; /> </manifest> ,[object Object],权限名称 权限描述 接收短信 android.permission.RECEIVE_SMS 拨打电话 android.permission.CALL_PHONE 系统启动完毕通知 android.permission.RECEIVE_BOOT_COMPLETED 读取联系人信息 android.permission.READ_CONTACTS 修改联系人信息 android.permission.WRITE_CONTACTS
目录 Android 环境配置和开发 Android 平台架构 Android 应用程序构成 如何开发一个例子
从 Internet 获取数据 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
从 Internet 获取数据 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
向 Internet 发送请求参数 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
向 Internet 发送请求参数 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
= 向 Internet 发送 xml 数据 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
HTTP 多线程断点下载应用程序   ,[object Object]
HTTP 多线程断点下载应用程序 ,[object Object],[object Object]
HTTP 多线程断点下载应用程序 ,[object Object]
谢谢!

More Related Content

What's hot

Vaadin with Java EE 7
Vaadin with Java EE 7Vaadin with Java EE 7
Vaadin with Java EE 7Peter Lehto
 
Android apps development
Android apps developmentAndroid apps development
Android apps developmentRaman Pandey
 
Application Frameworks - The Good, The Bad & The Ugly
Application Frameworks - The Good, The Bad & The UglyApplication Frameworks - The Good, The Bad & The Ugly
Application Frameworks - The Good, The Bad & The UglyRichard Lord
 
Android Cloud to Device Messaging Framework at GTUG Stockholm
Android Cloud to Device Messaging Framework at GTUG StockholmAndroid Cloud to Device Messaging Framework at GTUG Stockholm
Android Cloud to Device Messaging Framework at GTUG StockholmJohan Nilsson
 
Tools & tricks for testing React applications
Tools & tricks for testing React applications Tools & tricks for testing React applications
Tools & tricks for testing React applications React London Community
 
Android development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & IntentsLope Emano
 
Vaadin DevDay 2017 - DI your UI
Vaadin DevDay 2017 - DI your UIVaadin DevDay 2017 - DI your UI
Vaadin DevDay 2017 - DI your UIPeter Lehto
 
The Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDKThe Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDKGun Lee
 
Vaadin 8 with Spring Framework
Vaadin 8 with Spring FrameworkVaadin 8 with Spring Framework
Vaadin 8 with Spring FrameworkPeter Lehto
 
Android Components & Manifest
Android Components & ManifestAndroid Components & Manifest
Android Components & Manifestma-polimi
 
Vaadin 8 with Spring Frameworks AutoConfiguration
Vaadin 8 with Spring Frameworks AutoConfigurationVaadin 8 with Spring Frameworks AutoConfiguration
Vaadin 8 with Spring Frameworks AutoConfigurationPeter Lehto
 
Android architecture
Android architecture Android architecture
Android architecture Trong-An Bui
 
Android development Training Programme Day 2
Android development Training Programme Day 2Android development Training Programme Day 2
Android development Training Programme Day 2DHIRAJ PRAVIN
 
What's new in Android O
What's new in Android OWhat's new in Android O
What's new in Android OKirill Rozov
 

What's hot (20)

Vaadin with Java EE 7
Vaadin with Java EE 7Vaadin with Java EE 7
Vaadin with Java EE 7
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Application Frameworks - The Good, The Bad & The Ugly
Application Frameworks - The Good, The Bad & The UglyApplication Frameworks - The Good, The Bad & The Ugly
Application Frameworks - The Good, The Bad & The Ugly
 
Android Basic Components
Android Basic ComponentsAndroid Basic Components
Android Basic Components
 
Android Cloud to Device Messaging Framework at GTUG Stockholm
Android Cloud to Device Messaging Framework at GTUG StockholmAndroid Cloud to Device Messaging Framework at GTUG Stockholm
Android Cloud to Device Messaging Framework at GTUG Stockholm
 
Tools & tricks for testing React applications
Tools & tricks for testing React applications Tools & tricks for testing React applications
Tools & tricks for testing React applications
 
Android development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & Intents
 
Vaadin DevDay 2017 - DI your UI
Vaadin DevDay 2017 - DI your UIVaadin DevDay 2017 - DI your UI
Vaadin DevDay 2017 - DI your UI
 
The Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDKThe Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDK
 
Vaadin 8 with Spring Framework
Vaadin 8 with Spring FrameworkVaadin 8 with Spring Framework
Vaadin 8 with Spring Framework
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 
Android Components
Android ComponentsAndroid Components
Android Components
 
Android Components & Manifest
Android Components & ManifestAndroid Components & Manifest
Android Components & Manifest
 
Vaadin 8 with Spring Frameworks AutoConfiguration
Vaadin 8 with Spring Frameworks AutoConfigurationVaadin 8 with Spring Frameworks AutoConfiguration
Vaadin 8 with Spring Frameworks AutoConfiguration
 
Android architecture
Android architecture Android architecture
Android architecture
 
Week 7
Week 7Week 7
Week 7
 
Android development Training Programme Day 2
Android development Training Programme Day 2Android development Training Programme Day 2
Android development Training Programme Day 2
 
Android session 2
Android session 2Android session 2
Android session 2
 
What's new in Android O
What's new in Android OWhat's new in Android O
What's new in Android O
 
Android UI Fundamentals part 1
Android UI Fundamentals part 1Android UI Fundamentals part 1
Android UI Fundamentals part 1
 

Viewers also liked

Presentation to CIPR local public services conference - October 2009
Presentation to CIPR local public services conference - October 2009Presentation to CIPR local public services conference - October 2009
Presentation to CIPR local public services conference - October 2009simonwakeman
 
Week 01
Week 01Week 01
Week 01tjutel
 
Social Media for the Public Sector presentation - Connected Nottingham - 3 De...
Social Media for the Public Sector presentation - Connected Nottingham - 3 De...Social Media for the Public Sector presentation - Connected Nottingham - 3 De...
Social Media for the Public Sector presentation - Connected Nottingham - 3 De...simonwakeman
 
Merkatu Ikerkuntza 2. Gaia
Merkatu Ikerkuntza 2. GaiaMerkatu Ikerkuntza 2. Gaia
Merkatu Ikerkuntza 2. Gaiakatixa
 
Interactions 2011 Summary
Interactions 2011 SummaryInteractions 2011 Summary
Interactions 2011 SummaryJason Mesut
 
PHP and the Cloud (phpbenelux conference)
PHP and the Cloud (phpbenelux conference)PHP and the Cloud (phpbenelux conference)
PHP and the Cloud (phpbenelux conference)Ivo Jansch
 
PHP in a mobile ecosystem
PHP in a mobile ecosystem PHP in a mobile ecosystem
PHP in a mobile ecosystem Ivo Jansch
 
Understanding the New Breed of Digital Donors
Understanding the New Breed of Digital DonorsUnderstanding the New Breed of Digital Donors
Understanding the New Breed of Digital DonorsJonathan Waddingham
 
Festa Dei Sozzi
Festa Dei SozziFesta Dei Sozzi
Festa Dei Sozzialdamith
 
Using blogging to build supporter engagement
Using blogging to build supporter engagementUsing blogging to build supporter engagement
Using blogging to build supporter engagementJonathan Waddingham
 
Digital lessons from Haiti - #DigiFun2010
Digital lessons from Haiti - #DigiFun2010Digital lessons from Haiti - #DigiFun2010
Digital lessons from Haiti - #DigiFun2010Jonathan Waddingham
 
Гибридные DVB-C + IP решения для операторов кабельного цифрового телевидения
Гибридные DVB-C + IP решения для операторов кабельного цифрового телевиденияГибридные DVB-C + IP решения для операторов кабельного цифрового телевидения
Гибридные DVB-C + IP решения для операторов кабельного цифрового телевиденияDenis Mishin
 
Jörissen, Benjamin (2009, Manuskript). Games, reflexivity, and governance
Jörissen, Benjamin (2009, Manuskript). Games, reflexivity, and governanceJörissen, Benjamin (2009, Manuskript). Games, reflexivity, and governance
Jörissen, Benjamin (2009, Manuskript). Games, reflexivity, and governanceBenjamin Jörissen
 
Digital Pioneers intro Summit
Digital Pioneers intro SummitDigital Pioneers intro Summit
Digital Pioneers intro SummitKennisland
 

Viewers also liked (20)

Tesaloničania od obrátenia k posväteniu
Tesaloničania   od obrátenia k posväteniuTesaloničania   od obrátenia k posväteniu
Tesaloničania od obrátenia k posväteniu
 
Presentation to CIPR local public services conference - October 2009
Presentation to CIPR local public services conference - October 2009Presentation to CIPR local public services conference - October 2009
Presentation to CIPR local public services conference - October 2009
 
Week 01
Week 01Week 01
Week 01
 
Jednota a rozmanitosť (ef 4)
Jednota a rozmanitosť (ef 4)Jednota a rozmanitosť (ef 4)
Jednota a rozmanitosť (ef 4)
 
Social Media for the Public Sector presentation - Connected Nottingham - 3 De...
Social Media for the Public Sector presentation - Connected Nottingham - 3 De...Social Media for the Public Sector presentation - Connected Nottingham - 3 De...
Social Media for the Public Sector presentation - Connected Nottingham - 3 De...
 
Merkatu Ikerkuntza 2. Gaia
Merkatu Ikerkuntza 2. GaiaMerkatu Ikerkuntza 2. Gaia
Merkatu Ikerkuntza 2. Gaia
 
Interactions 2011 Summary
Interactions 2011 SummaryInteractions 2011 Summary
Interactions 2011 Summary
 
PHP and the Cloud (phpbenelux conference)
PHP and the Cloud (phpbenelux conference)PHP and the Cloud (phpbenelux conference)
PHP and the Cloud (phpbenelux conference)
 
Advent - Otvorenost
Advent - OtvorenostAdvent - Otvorenost
Advent - Otvorenost
 
PHP in a mobile ecosystem
PHP in a mobile ecosystem PHP in a mobile ecosystem
PHP in a mobile ecosystem
 
Prezentacia M24 3
Prezentacia M24 3Prezentacia M24 3
Prezentacia M24 3
 
Understanding the New Breed of Digital Donors
Understanding the New Breed of Digital DonorsUnderstanding the New Breed of Digital Donors
Understanding the New Breed of Digital Donors
 
Visual image
Visual imageVisual image
Visual image
 
Festa Dei Sozzi
Festa Dei SozziFesta Dei Sozzi
Festa Dei Sozzi
 
Using blogging to build supporter engagement
Using blogging to build supporter engagementUsing blogging to build supporter engagement
Using blogging to build supporter engagement
 
Digital lessons from Haiti - #DigiFun2010
Digital lessons from Haiti - #DigiFun2010Digital lessons from Haiti - #DigiFun2010
Digital lessons from Haiti - #DigiFun2010
 
Гибридные DVB-C + IP решения для операторов кабельного цифрового телевидения
Гибридные DVB-C + IP решения для операторов кабельного цифрового телевиденияГибридные DVB-C + IP решения для операторов кабельного цифрового телевидения
Гибридные DVB-C + IP решения для операторов кабельного цифрового телевидения
 
UX Must Die
UX Must DieUX Must Die
UX Must Die
 
Jörissen, Benjamin (2009, Manuskript). Games, reflexivity, and governance
Jörissen, Benjamin (2009, Manuskript). Games, reflexivity, and governanceJörissen, Benjamin (2009, Manuskript). Games, reflexivity, and governance
Jörissen, Benjamin (2009, Manuskript). Games, reflexivity, and governance
 
Digital Pioneers intro Summit
Digital Pioneers intro SummitDigital Pioneers intro Summit
Digital Pioneers intro Summit
 

Similar to Android应用开发简介

Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recieversUtkarsh Mankad
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorialAbid Khan
 
Android App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structureAndroid App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structureVijay Rastogi
 
Android Tutorial
Android TutorialAndroid Tutorial
Android TutorialFun2Do Labs
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android AppsGil Irizarry
 
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxxMAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx34ShreyaChauhan
 
Android apps development
Android apps developmentAndroid apps development
Android apps developmentMonir Zzaman
 
Android presentation
Android presentationAndroid presentation
Android presentationImam Raza
 
Training Session 2 - Day 2
Training Session 2 - Day 2Training Session 2 - Day 2
Training Session 2 - Day 2Vivek Bhusal
 
android training_material ravy ramio
android training_material ravy ramioandroid training_material ravy ramio
android training_material ravy ramioslesulvy
 
Mobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdfMobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdfAbdullahMunir32
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recieversJagdish Gediya
 
Android application development
Android application developmentAndroid application development
Android application developmentMd. Mujahid Islam
 

Similar to Android应用开发简介 (20)

Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structureAndroid App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structure
 
Android Tutorial
Android TutorialAndroid Tutorial
Android Tutorial
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android Apps
 
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxxMAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
Android presentation
Android presentationAndroid presentation
Android presentation
 
Android101
Android101Android101
Android101
 
Training Session 2 - Day 2
Training Session 2 - Day 2Training Session 2 - Day 2
Training Session 2 - Day 2
 
android training_material ravy ramio
android training_material ravy ramioandroid training_material ravy ramio
android training_material ravy ramio
 
Mobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdfMobile Application Development -Lecture 09 & 10.pdf
Mobile Application Development -Lecture 09 & 10.pdf
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
 
Introduction toandroid
Introduction toandroidIntroduction toandroid
Introduction toandroid
 
Android application development
Android application developmentAndroid application development
Android application development
 

More from easychen

IDF2013大会分享——《使用新浪移动云开发全平台应用》
IDF2013大会分享——《使用新浪移动云开发全平台应用》IDF2013大会分享——《使用新浪移动云开发全平台应用》
IDF2013大会分享——《使用新浪移动云开发全平台应用》easychen
 
互联网商品设计
互联网商品设计互联网商品设计
互联网商品设计easychen
 
TeamToy-创新团队的效率工具
TeamToy-创新团队的效率工具TeamToy-创新团队的效率工具
TeamToy-创新团队的效率工具easychen
 
我是产品经理我需不需要学技术
我是产品经理我需不需要学技术我是产品经理我需不需要学技术
我是产品经理我需不需要学技术easychen
 
10min mobile-app
10min mobile-app10min mobile-app
10min mobile-appeasychen
 
新浪云平台的经验和教训
新浪云平台的经验和教训新浪云平台的经验和教训
新浪云平台的经验和教训easychen
 
在Sae上开发高性能微博应用
在Sae上开发高性能微博应用在Sae上开发高性能微博应用
在Sae上开发高性能微博应用easychen
 
Qt编程介绍
Qt编程介绍Qt编程介绍
Qt编程介绍easychen
 
Autotools
Autotools Autotools
Autotools easychen
 
如何利用社会化网络制造流行潮
如何利用社会化网络制造流行潮如何利用社会化网络制造流行潮
如何利用社会化网络制造流行潮easychen
 
写给技术人员的产品指南
写给技术人员的产品指南写给技术人员的产品指南
写给技术人员的产品指南easychen
 
为什么你需要了解应用云
为什么你需要了解应用云为什么你需要了解应用云
为什么你需要了解应用云easychen
 
为什么你需要了解应用云
为什么你需要了解应用云为什么你需要了解应用云
为什么你需要了解应用云easychen
 

More from easychen (13)

IDF2013大会分享——《使用新浪移动云开发全平台应用》
IDF2013大会分享——《使用新浪移动云开发全平台应用》IDF2013大会分享——《使用新浪移动云开发全平台应用》
IDF2013大会分享——《使用新浪移动云开发全平台应用》
 
互联网商品设计
互联网商品设计互联网商品设计
互联网商品设计
 
TeamToy-创新团队的效率工具
TeamToy-创新团队的效率工具TeamToy-创新团队的效率工具
TeamToy-创新团队的效率工具
 
我是产品经理我需不需要学技术
我是产品经理我需不需要学技术我是产品经理我需不需要学技术
我是产品经理我需不需要学技术
 
10min mobile-app
10min mobile-app10min mobile-app
10min mobile-app
 
新浪云平台的经验和教训
新浪云平台的经验和教训新浪云平台的经验和教训
新浪云平台的经验和教训
 
在Sae上开发高性能微博应用
在Sae上开发高性能微博应用在Sae上开发高性能微博应用
在Sae上开发高性能微博应用
 
Qt编程介绍
Qt编程介绍Qt编程介绍
Qt编程介绍
 
Autotools
Autotools Autotools
Autotools
 
如何利用社会化网络制造流行潮
如何利用社会化网络制造流行潮如何利用社会化网络制造流行潮
如何利用社会化网络制造流行潮
 
写给技术人员的产品指南
写给技术人员的产品指南写给技术人员的产品指南
写给技术人员的产品指南
 
为什么你需要了解应用云
为什么你需要了解应用云为什么你需要了解应用云
为什么你需要了解应用云
 
为什么你需要了解应用云
为什么你需要了解应用云为什么你需要了解应用云
为什么你需要了解应用云
 

Recently uploaded

Introduction to Quantum Computing
Introduction to Quantum ComputingIntroduction to Quantum Computing
Introduction to Quantum ComputingGDSC PJATK
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
Spring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdfSpring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdfAnna Loughnan Colquhoun
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
GenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation IncGenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation IncObject Automation
 
Babel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxBabel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxYounusS2
 

Recently uploaded (20)

Introduction to Quantum Computing
Introduction to Quantum ComputingIntroduction to Quantum Computing
Introduction to Quantum Computing
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
Spring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdfSpring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdf
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
GenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation IncGenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation Inc
 
Babel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxBabel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptx
 

Android应用开发简介

Editor's Notes

  1. Android 框架分为四层: kernel 、 libraries 、 framework 、 applications 1. 最低层是 linux kernel ,主要负责内存管理、进程调度等系统管理以及终端的硬件驱动。 Binder driver , google 为 android 设计的一个增强系统的进程间通信能力的模块。 2. Kernel 的上一层是 libraries ,包含了核心库、第三方库和 android 虚拟机。 android 并没有直接采用传统的 j2se 或 j2me 的 java 虚拟机,而是自己建立了一个称为 dalvik 的虚拟机,号称更节省字节码的空间,性能更好。但这也成为了 google 与 sun 关于 java 版权争议点。 以上两层是采用 C 语言或汇编语言实现的。 3. Framework 是 android 为应用开发者设计的一套软件框架,提供了丰富的 api 和一些现成的开发元素。 Framework 是采用 java 语言实现的。在 NDK 出来之前, android 应用开发者基本上只能用 java 来开发应用。 Android 使用 JNI( Java Native Interface ) 连接了 libraries 和 framework 。 4. Application 就是在 framework 的基础上开发的各种应用。 以上是 android 系统的总体框架。
  2. res/drawable 专门存放 png 、 jpg 等图标文件。在代码中使用 getResources().getDrawable(resourceId) 获取该目录下的资源。 res/layout 专门存放 xml 界面文件, xml 界面文件和 HTML 文件一样,主要用于显示用户操作界面。 res/values 专门存放应用使用到的各种类型数据。不同类型的数据存放在不同的文件中,如下: · strings.xml 定义字符串和数值,在 Activity 中使用 getResources().getString(resourceId) 或 getResources().getText(resourceId) 取得资源。它的作用和 struts 中的国际化资源文件一样。 &lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&gt; &lt;resources&gt; &lt;string name=“itcast”&gt;****&lt;/string&gt; &lt;/resources&gt; · arrays.xml 定义数组。 &lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&gt; &lt;resources&gt; &lt;string-array name=&amp;quot;colors&amp;quot;&gt; &lt;item&gt;red&lt;/item&gt; &lt;item&gt;yellow&lt;/item&gt; &lt;item&gt;green&lt;/item&gt; &lt;item&gt;blue&lt;/item&gt; &lt;/string-array&gt; &lt;/resources&gt; · colors.xml 定义颜色和颜色字串数值,你可以在 Activity 中使用 getResources().getDrawable(resourceId) 以及 getResources().getColor(resourceId) 取得这些资源。例子如下: &lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&gt; &lt;resources&gt; &lt;color name=&amp;quot;contents_text&amp;quot;&gt;#ff000000&lt;/color&gt; &lt;/resources&gt; · dimens.xml 定义尺寸数据,在 Activity 中使用 getResources().getDimension(resourceId) 取得这些资源 &lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&gt; &lt;resources&gt; &lt;dimen name=&amp;quot;key_height&amp;quot;&gt;50dip&lt;/dimen&gt; &lt;/resources&gt; · styles.xml 定义样式。 &lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&gt; &lt;resources&gt; &lt;style name=&amp;quot;itcastText&amp;quot; parent=&amp;quot;@style/Text&amp;quot;&gt; &lt;item name=&amp;quot;android:textSize&amp;quot;&gt;18px&lt;/item&gt; &lt;item name=&amp;quot;android:textColor&amp;quot;&gt;#008&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; res/anim/ 编译成帧动画的 XML 文件。 res/xml/ 在 Activity 中使用 getResources().getXML() 读取该目录下的 XML 资源文件。 res/raw/ 该目录下的文件将直接被复制到设备上。编译软件时,这些数据不会被编译,它们被直接加入到程序安装包里。 为了在程序中使用这些资源,你可以调用 getResources().openRawResource(ID) , 参数 ID 形式: R.raw. somefilename 。
  3. 下面具体看看一个 android 应用程序的框架。 包含了 5 个部分: activity , service , intent , broadcast receiver , content provider
  4. 当 activity 处于 pause 或者 stop 状态时,都可能被系统终止并回收。因此,有必要在 onPause 和 onStop 方法中将应用程序运行过程中的一些状态,例如用户输入等,保存到持久存储中。如果程序中启动了其他后台线程,也需要注意在这些方法中进行一些处理,例如在线程中打开了一个进度条对话框,如果不在 pause 或 stop 中 cancel 掉线程,则当线程运行完 cancel 掉对话框时就会抛出异常。 Project : ActivityLifecycle
  5. Intent 可以理解为应用程序向系统表达的一种意愿 : 希望系统做什么。 一个 Activity 可以通过 intent 来启动另外的 activity 或 service 实例,或者通过 intent 来发起一个广播。 Service 可以通过 intent 来启动一个 activity 或另一个 service 实例,也可以通过 intent 发起一个广播。 Broadcast receiver 通过获取 intent 取得其关注的广播消息。
  6. 显式的,应用程序向系统发出 intent ,指明需要哪一个 component 处理。 隐式的,应用程序向系统发出一个 intent ,但没有具体指明该 intent 的接收者,由系统匹配最合适的接收者负责处理。如果存在多个匹配,那么系统会弹出对话框给用户选择处理的应用。 系统如何知道哪些 component 可以处理哪些 intent ?在 androidmanifest.xml 文件中定义 intent-filter
  7. Filter 分三类, action 、 category 、 data 在 filter 中定义相关的匹配规则,告知系统对应的 component 可以接受哪些 intent
  8. ACTION_CALL 拨出 Data 里指定的电话号码 ACTION_EDIT 打开编辑 Data 里指定数据相对应的应用程序 ACTION_MAIN 主程序入口,不会接收数据,结束后也不返回数据 ACTION_SYNC 在 Android 平台和服务器之间同步数据 ACTION_VIEW 根据 Data 类型的不同,打开相对应的应用程序以显示数据 ACTION_DIAL 启动 Dialer 或其他拨号程序,并显示 Data 里指定的电话号码 ACTION_SENDTO 向 Data 里描述的目标地址发送数据 ACTION_TIME_TICK 系统时间每过一分钟发出的广播 ACTION_TIME_CHANGED 系统时间通过设置发生了变化 ACTION_TIMEZONE_CHANGED 时区改变 ACTION_BOOT_COMPLETED 系统启动完毕 ACTION_PACKAGE_ADDED 新的应用程序 apk 包安装完毕 ACTION_PACKAGE_CHANGED 现有应用程序 apk 包改变 ACTION_PACKAGE_REMOVED 现有应用程序 apk 包被删除 ACTION_UID_REMOVED 用户 id 被删除
  9. 一个 service 也有其生命周期,从创建到启动,到最后的撤销。 上一页 ppt 提到两种创建 service 的方法, startService 或者 bindService ,他们的区别就在于, startService 是创建并启动 service ,而 bindService 只是创建了一个 service 实例并取得了一个与该 service 关联的 binder 对象,但没有启动它。 Project: local service controller
  10. 在 android 中,系统对资源和数据的管理机制是这样的: 每一个应用的资源是私有的,如果应用本身没有开放这些资源,其他应用是无法访问到这些资源的。 Android 通过将每一个应用视为一个 linux 用户来实现这一机制。 那么,如果一个应用希望它所拥有的资源和数据可以被其他应用使用,那么就需要通过 content provider 来对外提供访问接口。
  11. 如何使用 content provider ? Android 使用了 content resolver 和 uri 数据表示方式,提供对 content provider 的统一访问。 应用在使用 content resolver 访问需要的数据时,系统 content resolver 根据传入的 uri ,定位到该 uri 对应的 content provider ,完成相应的操作。 Content provider 提供了一种类似于数据库二维表的数据展现和访问方式。 从图中也可以看到,一个 content provider 被注册之后,它就可以被所有的应用通过 content resolver 访问了。
  12. Content resolver 如何定位具体要访问哪个 content provider 呢? Android 使用 uri 来定位资源,即 content resolver 依靠 uri 来找到要访问的 content provider 。 两个例子:通信录联系人的 uri ,第二个是通话记录的 uri 。 Android 提供了一种类似数据库访问的方式来使用 content resolver ,并且以二维表的形式表现访问的数据。
  13. Preference 提供了一种轻量级的存取机制,主要是可以通过关键字读取和存储某个 Preference value, 比如载系统启动的时候得到上次系统退出时候保存的值。 File 机制你可以直接存储一个文件到你手机文件系统路径比如 SD 卡中 Network 通过网络来存储数据,使用下面两个包的 java class. java.net.*    android.net.* 
  14. Android 在接收到一个广播 intent 之后,找到了处理该 intent 的 broadcast receiver ,创建一个对象来处理 intent 。 然后,调用被创建的 broadcast receiver 对象的 onReceive 方法进行处理,然后就撤销这个对象。 需要注意的是,对象在 onReceive 方法返回之后就被撤销,所以在 onReceive 方法中不宜处理异步的过程。
  15. 有时候我们的应用需要使用一些系统提供的能力,例如拨打电话,接收短信等。这时我们就需要向系统申请使用这些能力的权限了。 android 通过在 androidmanifest 文件中申明一系列的 &lt;uses-permission&gt; 来向应用程序开放指定的权限。