第一章 Hello,Android

WHAT SINTHISCHAPTER?

Abackgroundtomobileapplicationdevelopment

WhatAndroidis(andwhatitisn t)

AnintroductiontotheAndroidSDKfeatures

WhatdevicesAndroidrunson

WhydevelopformobileandAndroid?

AnintroductiontotheSDKandtheAndroiddevelopmentframework

本章内容:

  • 移动应用开发背景
  • Android是与不是
  • 介绍AndroidSDK特性
  • Android运行在什么设备上
  • 为什么为手机和Android开发?
  • 介绍SDK和Android开发框架

Whetheryou’reanexperiencedmobileengineer,adesktoporwebdeveloper,oracomplete

programmingnovice ,Androidrepresentsanexcitingnewopportunitytowriteinnovativeapplications formobiledevices.

无论你是否是一个老练的手机工程师,一个桌面或Web程序员,或一个彻底的编程菜鸟,Android代表的是一个激动人心的为手机设备开发新应用的崭新机会。

Despitethename,Androidwillnothelpyoucreateanunstoppablearmyofemotionless robot

warriors onarelentless questtocleansetheearthofthescourgeofhumanity.

别管这个名字,Android不会帮你创造一直永不停息的没有感情的机器人战士军队来无情地消灭地球上的人类。

Instead,Android isanopen-sourcesoftwarestackthatincludestheoperatingsystem,middleware,andkey mobileapplicationsalongwithasetofAPIlibrariesforwritingmobileapplicationsthatcan shape thelook,feel,andfunctionofmobilehandsets.

相反,Android是一个开源软件包括了操作系统,中间件和关键的手机应用及一组用于开发视觉、感官和功能都符合手机硬件的手机应用移动的API库。

Small,stylish ,andversatile ,modernmobiledeviceshavebecomepowerfultoolsthatincorporate cameras,mediaplayers,GPSsystems,andtouchscreens.Astechnologyhasevolved ,mobile phoneshavebecomeaboutmorethansimplymakingcalls,buttheirsoftwareanddevelopment platformshavestruggled tokeeppace .

小巧,时髦,功能种多,现代手机设备变为强大的工具,吸纳了照相机,多媒体,GSP系统和触摸屏。随着技术的发展,手机变得不仅仅能打电话,但是他们的软件和开发平台的努力依旧缓步不前。

Untilrecently,mobilephoneswerelargelyclosedenvironmentsbuiltonhighlyfragmented,proprietary operatingsystemsthatrequiredproprietarydevelopmenttools.

直到最近,手机厂商很大程度上封闭地构造在高度分裂的环境上,操作系统和开发工具都是私有的。

Thephonesthemselves oftenprioritized nativeapplicationsoverthosewrittenbythirdparties.Thishasintroducedan artificial barrierfordevelopershopingtobuildonincreasinglypowerfulmobilehardware.

手机厂商自己经常优先照顾自己的应用而非第三方应用。这种行为对开发者希望在手机硬件上构造强大的应用造成了一种人为的障碍。

InAndroid,nativeandthird-partyapplicationsarewrittenwiththesameAPIsandexecutedonthe sameruntime.TheseAPIsfeaturehardwaresensoraccess,videorecording,location-basedservices, supportforbackgroundservices,map-basedactivities,relationaldatabases,inter-applicationcommunication, and2Dand3Dgraphics.

在Android中,本地和第三方应用都是用相同的API开发在相同时间被执行。这些API以访问传感器硬件、视频记录、本地定位服务、支持后台服务、基于地图的Activity、关系数据库、应用互通信、2D和3D图形为特色。

Usingthisbook,youwilllearnhowtousetheseAPIstocreateyourownAndroidapplications.Inthis chapteryou’lllearnsomemobiledevelopmentguidelines andbeintroducedtothefeaturesavailable fromtheAndroiddevelopmentplatform.

使用本书,你将学习如何用这些API来创建你自己的Android应用。本章你将学习一些手机开发的指导方针 介绍Android开发平台的特征。

AndroidhaspowerfulAPIs,excellent documentation,athriving developercommunity,andnodevelopment ordistributioncosts.Asmobiledevicescontinuetoincreaseinpopularity ,thisisanexciting opportunitytocreateinnovativemobilephoneapplicationsnomatterwhatyourdevelopment experience.

Android有强大的API,卓越的文档,一个人气兴旺的开发者社区和免费的开发或发布环境。如果移动设备继续普及流行,无论你是否有开发经验都将是一个令人兴奋的开发新型手机应用的机会。

ALITTLEBACKGROUND

一个小背景

InthedaysbeforeTwitterandFacebook,whenGooglewasstillatwinkle initsfounders’eyesand dinosaursroamed theearth,mobilephoneswerejustthat—portable phonessmallenoughtofit inside abriefcase ,featuringbatteriesthatcouldlastupto severalhours.Theydidhoweverofferthefreedom tomakecallswithoutbeingphysicallyconnectedtoalandline .

在Twitter和Fackbook之前,当谷歌仍然还在创始人的酝酿之中好比恐龙还漫步在地球上,手机还只是小得足够放在公文包里,特性电池最多用几个小时。可还是提供了不需要连接到通讯线路就能打电话的自由。

Increasinglysmall,stylish,andpowerfulmobilephonesarenowasubiquitous astheyareindispensable . Hardwareadvancementshavemademobilessmallerandmoreefficientwhileincludinganincreasing numberofperipherals.

日益增长的小巧、时髦并功能强大的手机现在因其乃不可缺少之物而已无所不在。硬件的发展使得手机越来越小,加上了更多外围设备后也变得越发有用。

Afterfirstgettingcamerasandmediaplayers,mobilesnowincludeGPSsystems,accelerometers,and touchscreens.Whilethesehardwareinnovations shouldprove fertile groundforsoftwaredevelopment, theapplicationsavailablefor mobilephoneshavegenerallylagged behindthehardware.

在最早配备了照相机和多媒体后,手机现在加入了GPS系统,加速器和触摸屏。当这些新型的硬件能提供多样的软件开发的基础,有效的应用程序通常都可以支持底层的硬件。

TheNot-So-Distant Past

不远的过去

Historically ,developers,generallycodinginlow-levelCorC++,haveneededtounderstandthespecific hardwaretheywerecodingfor,generallyasingledeviceorpossibly arangeofdevicesfromasingle manufacturer .AshardwaretechnologyandmobileInternetaccesshasadvanced,thisclosedapproach hasbecomeoutmoded .

历史上,开发者,通常用底层的C或者C++开发,必须对他们理解面对的硬件,通常一个设备或可能是一个厂商的系列硬件。当硬件技术和手机访问因特网提速,这一切都过时了。

Morerecently,platformslikeSymbianhavebeencreatedtoprovidedeveloperswithawidertarget audience.Thesesystemshaveprovenmoresuccessfulinencouraging mobile d eveloperstoproviderich applicationsthatbetterleverage thehardwareavailable.

最近,很多像Symbian这样的平台开始提供开发者一个宽广的目标客户。这些系统证明了通过更好的可用的硬件来提供富应用以激励手机开发者是成功的。

Theseplatformsoffersomeaccesstothedevicehardware,butrequirethedevelopertowritecomplex C/C++codeandmakeheavyuseofproprietaryAPIsthatarenotoriously difficulttoworkwith.This difficultyisamplif iedforapplicationsthatmustworkondifferenthardwareimplementationsandthose thatmakeuseofaparticular hardwarefeature,likeGPS.

这些平台提供了一些访问硬件设备的渠道,丹需要开发者编写复杂的C/C++代码并大量使用众所周知难以驾驭的厂商的API。这些困难增加了应用程序运行在不同硬件上实现的难度,且要用到硬件的特性,比如GPS。

Inmorerecentyears,thebiggestadvanceinmobilephonedevelopmentwastheintroductionofJava hosted MIDlets.

更近几年,手机开发最大的提升是Java宿主下的 MIDlet 的引入。


MIDletsareexecutedonaJavavirtualmachine,aprocessthatabstractstheunderlying

hardwareandletsdeveloperscreateapplicationsthatrunonthewidevarietyofdevicesthatsupports theJavaruntime.Unfortunately ,thisconvenience comesat thepriceofrestricted accesstothedevice hardware.

MIDlet 在一个Java虚拟机( 一个抽象了底层硬件的进程 )上 执行 ,让开发者创建运行在广泛不同设备上的支持JRE的应用程序。不过,这样便于访问到受限制的硬件设备。

更多相关文章

  1. Qt for Android获取手机序列号
  2. Ubuntu 14.04烧Nexus 5手机
  3. Android 获取手机信息
  4. Android之获取手机信息
  5. android 判断手机是否插入SIM卡
  6. 解决魅族手机在下拉刷新的时候出现hold
  7. [Android实例] Android 开发者面试题-广播机制详解
  8. Android开发者的演示工具——asm.jar
  9. Android开发者指南(1) —— Android Debug Bridge(adb)(上)

随机推荐

  1. Java代理模式
  2. 2021.1.13
  3. Spring Cloud第七篇:高可用的配置中心
  4. SpringBoot第二十三篇: 异步方法
  5. pub哥的2020文章清单
  6. Spring Cloud第八篇:Spring Cloud Bus刷新
  7. 自学第四十七天
  8. SpringBoot第二十四篇: springboot整合doc
  9. Spring Cloud第九篇:链路追踪Sleuth
  10. 对标阿里P7的Java后端开发面试总结,搞定9