Android Development tutorial開發(fā)教程(50P)_第1頁
Android Development tutorial開發(fā)教程(50P)_第2頁
Android Development tutorial開發(fā)教程(50P)_第3頁
Android Development tutorial開發(fā)教程(50P)_第4頁
Android Development tutorial開發(fā)教程(50P)_第5頁
已閱讀5頁,還剩45頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、Android Development TutorialContents2Whats AndroidAndroid architectureAndroid software developmentHello World on AndroidMoreWhats Android3Android Phones4Mobile Devices5Its obvious that mobile device may take the place of PC in futureOS plays a vital partProcessorDeviceEmbedded OSMiddlewareApps6OHA a

2、nd Android7OHA(Open Handset Alliance) is a group of 71 technology and mobile companies, including Google, Intel, Dell, HTC and China MobileOHAs aim:accelerate innovation in mobile phonesoffer consumers a richer, less expensive, and better mobile experienceOHA developed Android, the first complete, o

3、pen, and free mobile platformOHA was initially called up by Google, and Google is the captainWhats Android8Generally, Android is a software stack for mobile devices that includes an operating system, middleware and key applications Android is based on JAVA and all its applications are developed in J

4、AVAThe JAVA VM, known as Dalvik, is highly customized and optimized for mobile devicesAndroid SDK offers rich tools for android application development and many useful APIs。The core of AndroidAndroid Features #19Application framework enabling reuse and replacement of components Optimized Java virtua

5、l machine: DalvikOptimized Graphics Processing, supporting 2D and 3D graphics(OpenGL ES 1.0 )Integrated open source web browser: WebKitSQLite for structured data storageAndroid Features #210Multimedia capability, supporting varieties of audio, video and still image formatsGSM TelephonyBluetooth, EDG

6、E, 3G and Wi-Fi supportCamera, GPS, compass, accelerometer and other sensors support Rich development environment, including an emulator, debugging tools, memory probe tools, log tools and powerful eclipse pluginsHardware dependentAndroid architecture1112Linux Kernel13Note that Android based on a Li

7、nux kernel not a Linux OSSupplies Security, Memory management, Process management, Network stack and Driver model Acts as an abstraction layer between the hardware and the rest of the software stackLibraries14Run in system backgroundUsing C/C+ Language4 types of LibrariesBionic Libc, system C librar

8、iesFunction Libraries, supporting multimedia, web browser, SQLite.Native ServersHardware Abstraction LibrariesCore Libraries15System C library, the standard C system library, tuned for embedded Linux-based devicesMedia Libraries, support playback and recording of many popular audio and video formats

9、, as well as image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNGSurface Manager, manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applicationsWebKit, a modern web browser engine which powers both the Android browser and an embeddab

10、le web viewSGL, the underlying 2D graphics engine3D libraries, an implementation based on OpenGL ES 1.0 APIsFreeType , bitmap and vector font renderingSQLite , a powerful and lightweight relational database engineAndoid Runtime16The core of Android platformDalvik Virtual MachineRegister-basedExecute

11、s files in the Dalvik Executable (.dex) formatJava core LibrariesProvides most of the functionality of the Java programming language.Android Runtime (cont.)17The functions of Java core libraries rely on the Dalvik VM and the underlying Linux kernelMultiple Dalvik VMs may run at the same timeEvery An

12、droid application runs in its own process, with its own instance of the Dalvik virtual machineThe dx tool in Android SDK can transform compiled JAVA class into the .dex formatDalvik Virtual Machine18Android custom implementation virtual machineProvides application portability and runtime consistency

13、Runs optimized file format (.dex) and Dalvik bytecodeJava .class / .jar files converted to .dex at build timeDesigned for embedded environmentSupports multiple virtual machine processes per deviceHighly CPU-optimized bytecode interpreterEfficiently Using runtime memoryCore LibrariesCore APIs for Jav

14、a language provide a powerful, yet simple and familiar development platformDVM vs. JVM19DVMGoogleDalvik executableOnly supports a subset of standard Java LibraryJVMSunJava bytecodeSome worries that Java world may be divided into different communities, each has its own Java standardApplication Framew

15、ork20Simplify the reuse of componentsApplications can publish their capabilities and any other application may then make use of those capabilitiesApplications is a set of services and systems, include Views system, content providers, resources manager and so onApplication Framework (cont.)21Activity

16、 Manager, manages the lifecycle of applications and provides a common navigation backstackNotification Manager, enables all applications to display custom alerts in the status barResource Manager, providing access to non-code resources such as localized strings, graphics, and layout filesContent Pro

17、viders, access data from other applications (such as Contacts), or to share their own dataViews, used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browserApplications22A set of core applications shipped with Android platforman email client, SMS pro

18、gram, calendar, maps, browser, contacts, and othersAll written in JavaOur applications are in the same level as these applicationsAndroid software development23Development EnvironmentIDE Eclipse Eclipse plug-in - ADTSoftware Development Kit (SDK)Android EmulatorDebuggerSetup Android SDK25Download An

19、droid SDK and extract the zip file to an arbitrary folderE.g.: extract to C:The SDK will be used by ADT in eclipseSetup ADT plugin26Install Eclipse ADT pluginEclipse must be J2EE edition, 3.5 recommendedUpdate site: Install all the plugins in the repositoryRestart needed after installationConfigure

20、ADT Plugin27Open eclipse Window-Preferences, select AndroidSetup the SDK location as the folder where you extracted the downloaded SDK zip fileSetup SDK APIs28Open Window-Android SDK and AVD ManagerClick Available Packages and then choose proper APIs to install, the latest may be the bestSetup Emula

21、tors29After SDK APIs installation, click Virtual Devices Click new, there will be a dialoginput a name choose a running target and a skin specify the SD card size Ready30Now you may start the AVDClick start to start the new AVDFirst start-up may take a very long time Hello World on Android31Create a

22、 new Android Project32Open File-New-Android projectProject nameBuild TargetApplication namePackage nameCreate ActivityHello World Project33src: source foldergen: SDK generated fileandroid 2.2: reference libassets: binary resourcesres: resource files and resource description filesAndroidManifest.xml:

23、 application description perties: project properties fileSay Hello World34Run Hello World35Select HelloWorld Project, Run-Run as-Android ApplicationADT will start a proper AVD and run HelloWorld app on itBehind HelloWorld #136R.java, generated by Android SDK, represents all the resources of the app.

24、 resources are all in res folderresources are pre-compiled into binary format/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */package sample.hello;public final class R public s

25、tatic final class attr public static final class drawable public static final int icon=0 x7f020000; public static final class layout public static final int main=0 x7f030000; public static final class string public static final int app_name=0 x7f040001; public static final int hello=0 x7f040000; Lin

26、ear LayoutBehind HelloWorld #237res/layout , contains layout declarations of the app, in XML format, UIs are built according to the layout file TextView, display static textA reference to String resource helloBehind HelloWorld #338res/values, contains string declarations or other values(e.g.:colors)

27、 of the appstring.xml, contains string resources Hello World, HelloWorld! HelloWorldBehind HelloWorld #439res/drawable, contains all image resourcesfolders may have suffixes, app will choose the most suitable one, so do the other resourcesthree folders: drawable-ldpi, drawable-hdpi, drawable-mdpi, e

28、ach contains an icon.png fileapp will choose the proper icon according to the device DPIreference name:drawable/iconother folders we may use in futuremenu, anim (animation), xml ( preference and searchable)Behind HelloWorld #540AndroidManifest.xml describe the applicationdeclare apps name, version,

29、icon, permission, etcdeclare the applications components: activity, service ,receiver or providerCore Components-Activity #141Basically, An activity presents a visual user interface for one focused endeavor the user can undertakeAn application might consist of just one activity or several, each Acti

30、vity is derived from and should be declared in AndroidManifest.xml fileEach activity is given a default window to draw in, the window may be full screen or smaller and on top of other windowThe visual content of the window is provided by a hierarchy of views objects derived from the base View classA

31、ctivity.setContentView() method is used to set a certain hierarchy of view objectsCore Components-Activity #242Activities are activated by asynchronous messages called intentsAn intent is an Intent object that holds the content of the messageThe action being requested or the URI of the data to act o

32、nThe label in AndroidManifest.xml file specifies the Intent that can start the Activitydeclares the main activity, it will be started automatically when the app startsAn activity is launched (or given something new to do) by passing an Intent object to Context.startActivity() or Activity.startActivi

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論