![有關android技術英文文獻翻譯_第1頁](http://file2.renrendoc.com/fileroot_temp3/2021-9/30/cff4de86-1bb8-4c4b-b458-ab7a5213f5af/cff4de86-1bb8-4c4b-b458-ab7a5213f5af1.gif)
![有關android技術英文文獻翻譯_第2頁](http://file2.renrendoc.com/fileroot_temp3/2021-9/30/cff4de86-1bb8-4c4b-b458-ab7a5213f5af/cff4de86-1bb8-4c4b-b458-ab7a5213f5af2.gif)
![有關android技術英文文獻翻譯_第3頁](http://file2.renrendoc.com/fileroot_temp3/2021-9/30/cff4de86-1bb8-4c4b-b458-ab7a5213f5af/cff4de86-1bb8-4c4b-b458-ab7a5213f5af3.gif)
![有關android技術英文文獻翻譯_第4頁](http://file2.renrendoc.com/fileroot_temp3/2021-9/30/cff4de86-1bb8-4c4b-b458-ab7a5213f5af/cff4de86-1bb8-4c4b-b458-ab7a5213f5af4.gif)
![有關android技術英文文獻翻譯_第5頁](http://file2.renrendoc.com/fileroot_temp3/2021-9/30/cff4de86-1bb8-4c4b-b458-ab7a5213f5af/cff4de86-1bb8-4c4b-b458-ab7a5213f5af5.gif)
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、 application fundamentals android applications are written in the java programming language. the compiled java code along with any data and resource files required by the application is bundled by the aapt tool into an android package, an archive file marked by an .apk suffix. this file is the vehic
2、le for distributing the application and installing it on mobile devices; its the file users download to their devices. all the code in a single .apk file is considered to be one application. android應用基礎:android應用程序是通過java語言開發(fā)的,通過綁定一些應用所需要的東西,例如:編譯的java代碼,加上數(shù)據(jù)和一些資源文件,使用一個apt的工具將所有的東西封裝成一個android包,這個文
3、件的文件后綴是.apk。這個文件是分發(fā)并安裝應用程序到移動設備的載體,是用戶獲得該應用程序所需要的下載的文件。application components a central feature of android is that one application can make use of elements of other applications (provided those applications permit it). for example, if your application needs to display a scrolling list of images and
4、another application has developed a suitable scroller and made it available to others, you can call upon that scroller to do the work, rather than develop your own. your application doesnt incorporate the code of the other application or link to it. rather, it simply starts up that piece of the othe
5、r application when the need arises. for this to work, the system must be able to start an application process when any part of it is needed, and instantiate the java objects for that part. therefore, unlike applications on most other systems, android applications dont have a single entry point for e
6、verything in the application (no main() function, for example). rather, they have essential components that the system can instantiate and run as needed. there are four types of components: activities an activity presents a visual user interface for one focused endeavor the user can undertake. for e
7、xample, an activity might present a list of menu items users can choose from or it might display photographs along with their captions. a text messaging application might have one activity that shows a list of contacts to send messages to, a second activity to write the message to the chosen contact
8、, and other activities to review old messages or change settings. though they work together to form a cohesive user interface, each activity is independent of the others. each one is implemented as a subclass of the activity base class. an application might consist of just one activity or, like the
9、text messaging application just mentioned, it may contain several. what the activities are, and how many there are depends, of course, on the application and its design. typically, one of the activities is marked as the first one that should be presented to the user when the application is launched.
10、 moving from one activity to another is accomplished by having the current activity start the next one. android有四大應用程序組件android的一個很重要的中心特征就是一個應用程序能充分利用其他的應用程序的一些組件(前提是被允許的) 例如:如果的當前開發(fā)的應用需要一個滾動的列表去展示相片并且當時其他的程序已經(jīng)開發(fā)了一個合適的滾動列表并且對其他人可用,你可以調用這個滾動的列表來完成你的工作而不是開發(fā)你自己的。你的應用不需要包含那個應用的代碼或來鏈接它。相反,它只是簡單的在你需要它是啟動
11、這部分的應用為了實現(xiàn)這部分的功能,當前系統(tǒng)必須能啟動其他應用程序進程的功能當那些部分它需要時,并且為這部分的java對象初始化這個java對象。因此,不想在其他系統(tǒng)中的應用程序,android應用程序不需要一個單一的入口點(例如:沒有main()而是,提供了實例化和運行所需的必備組件。android有四大應用程序組件1:activity一個activity基類是為展示可視化用戶接口。例如:一個activity可以顯示一個供用戶選擇的菜單列表,或者可以展示一些圖片以及對應的說明。一個短信的應用有一個活動顯示發(fā)送消息的一系列的聯(lián)系人,第二個活動去編寫信息文本去選擇聯(lián)系人,第三個活動去查看以前的信息
12、或修改一些設置。雖然它們組成了一個內聚的用戶界面,每一個活動都和其他的的相互獨立,每一個都繼承activity,是activity的子類。一個應用程序可以只有一個activity,但是也可以有多個,比如剛剛提到的文本應用。每個程序的作用,有多少個程序,取決于該應用的設計。servicesa service doesnt have a visual user interface, but rather runs in the background for an indefinite period of time. for example, a service might play backgro
13、und music as the user attends to other matters, or it might fetch data over the network or calculate something and provide the result to activities that need it. each service extends the service base class. 2:services服務是android中一個在后臺運行的應用程序,沒有可視化的用戶界面。例如:你可以在使用一個用戶程序的同時播放背景音樂。并且此時,播放音樂的代碼就不需要和用戶交互,因
14、此可以作為一個服務來運行,并且使用用戶服務的接口來實現(xiàn)音樂的播放,暫停,等功能。對于不用向用戶展示用戶界面的情況下,使用服務是一個理想的選擇。如同其他的組件一樣,services運行于應用程序進程的主線程內。所以它不會對其他組件或用戶界面有任何的妨礙,他們一般會派生一個新線程來執(zhí)行一些時間消耗型的任務。broadcast receivers a broadcast receiver is a component that does nothing but receive and react to broadcast announcements. many broadcasts originat
15、e in system code for example, announcements that the time zone has changed, that the battery is low, that a picture has been taken, or that the user changed a language preference. applications can also initiate broadcasts for example, to let other applications know that some data has been downloaded
16、 to the device and is available for them to use. an application can have any number of broadcast receivers to respond to any announcements it considers important. all receivers extend the broadcastreceiver base class. broadcast receivers do not display a user interface. however, they may start an ac
17、tivity in response to the information they receive, or they may use the notificationmanager to alert the user. notifications can get the users attention in various ways flashing the backlight, vibrating the device, playing a sound, and so on. they typically place a persistent icon in the status bar,
18、 which users can open to get the3:broadcast receiverbroadcast receiver是一個與注于接收廣播通知信息并做出相應處理的組件。許多廣播是由系統(tǒng)代碼產生的例如通知時區(qū)改變、電池電量低、拍攝了一張照片或者用戶改變了語言選項。應用程序也可以發(fā)起廣播例如通知其它應用程序一些數(shù)據(jù)已經(jīng)下載到設備上并處于可用狀態(tài)。 一個應用程序可以擁有任意數(shù)量的broadcast receiver以對所有它認為重要的通知信息予以響應。所有的receiver均繼承自broadcastreceiver基類。 broadcast receiver沒有用戶界面。然而它
19、們可以啟動一個activity來響應它們收到的信息或者也可以使用notificationmanager來通知用戶。通知可以用多種方式來吸引用戶的注意力閃動背光燈、震動設備、播放聲音等等。通知一般是在狀態(tài)欄上放一個持續(xù)的圖標用戶可以打開它并獲取消息。content providers a content provider makes a specific set of the applications data available to other applications. the data can be stored in the file system, in an sqlite data
20、base, or in any other manner that makes sense. the content provider extends the contentprovider base class to implement a standard set of methods that enable other applications to retrieve and store data of the type it controls. however, applications do not call these methods directly. rather they u
21、se a contentresolver object and call its methods instead. a contentresolver can talk to any content provider; it cooperates with the provider to manage any interprocess communication thats involved. see the separate content providers document for more information on using content providers. whenever
22、 theres a request that should be handled by a particular component, android makes sure that the application process of the component is running, starting it if necessary, and that an appropriate instance of the component is available, creating the instance if necessary. 4:內容提供者content providerconten
23、t provider將一些特定的應用程序數(shù)據(jù)供給其它應用程序使用。數(shù)據(jù)可以存儲于文件系統(tǒng)、sqlite數(shù)據(jù)庫或其它有意義的方式。content provider繼承于contentprovider 基類實現(xiàn)了一套使得其他應用程序能夠檢索和存儲它所管理類型數(shù)據(jù)的標準方法。然而應用程序并不直接調用返些方法而是使用一個 contentresolver 對象調用它的方法作為替代。contentresolver可以與任何content provider進行會話與其合作對任何相關的進程間通訊進行管理。 參閱獨立的content providers文檔以獲得更多關于使用content provider的信息
24、。 每當出現(xiàn)一個需要被特定組件處理的請求時android會確保那個組件的應用程序進程處于運行狀態(tài)必要時會啟動它并確保那個組件的一個合適的實例可必要時會創(chuàng)建那個實例。activating components激活組件three of the four component typesactivities, services, and broadcast receiversare activated by an asynchronous message called anintent. intents bind individual components to each other at runti
25、me (you can think of them as the messengers that request an action from other components), whether the component belongs to your application or another.四種類型組件中的三種:活動 服務和廣播接受者都通過一個叫做intent的異步消息激活。這些intents在運行時(runtime)將這些屬于你的程序或不同程序的單獨的組件綁定在一起(bind),你可以把這些intents看作是需要其他組件的action的messengers。an intent
26、is created with anintentobject, which defines a message to activate either a specific component or a specifictypeof componentan intent can be either explicit or implicit, respectively.一個intent通過一個intent對象建立,該intent對象定義了一個消息去激活一個特殊的組件或一種特殊的組件-一個intent既可以明確的說明也可以不明確,要分情況來看for activities and services,
27、an intent defines the action to perform (for example, to view or send something) and may specify the uri of the data to act on (among other things that the component being started might need to know). for example, an intent might convey a request for an activity to show an image or to open a web pag
28、e. in some cases, you can start an activity to receive a result, in which case, the activity also returns the result in anintent(for example, you can issue an intent to let the user pick a personal contact and have it returned to youthe return intent includes a uri pointing to the chosen contact).對于
29、活動和服務,一個intent定義了一個動作去執(zhí)行(比如:要view或者send什么)和要操作數(shù)據(jù)的uri,一個intent可能傳遞了為一個activity傳遞了一個請求去展示一張圖片或者打開一個網(wǎng)頁在這些例子中,你可以開始一個活動去接收結果,在這個例子中,這個activity也可以返回這個通過一個intent返回一個結果(例如,你可以發(fā)動一個intent去讓用戶選擇一個個人的contact并且返回給你,這個返回的意圖包括一個指向這個聯(lián)系人的uri)for broadcast receivers, the intent simply defines the announcement being
30、broadcast (for example, a broadcast to indicate the device battery is low includes only a known action string that indicates battery is low).對于廣播接收者來說,intent只是簡單的定義了要廣播的內容(比如,一個用以表明電池電量很低的廣播僅包含了一個表明電池電量很低的字符串)。the other component type, content provider, is not activated by intents. rather, it is act
31、ivated when targeted by a request from acontentresolver. the content resolver handles all direct transactions with the content provider so that the component thats performing transactions with the provider doesnt need to and instead calls methods on thecontentresolverobject. this leaves a layer of a
32、bstraction between the content provider and the component requesting information (for security).另外一個組件的類型,內容提供者,不是通過意圖激活。而是由接收到contentresolver請求是激活的這個內處理者處理所有的直接的事務通過內容提供者。因此,there are separate methods for activating each type of component:這里有不同的方法來激活不同類型的組件 you can start an activity (or give it som
33、ething new to do) by passing anintenttostartactivity()orstartactivityforresult()(when you want the activity to return a result). 你可啟動一個一個活動(或者給他一些新的要做的內容)通過傳遞一個intent來startactivity () 或者startactivityforresult()(當你需要這個activity返回一個結果時) you can start a service (or give new instructions to an ongoing se
34、rvice) by passing anintenttostartservice(). or you can bind to the service by passing anintenttobindservice().你可以啟動一個service(或者給一個內在的服務一些新的指令)通過傳遞一個intent來startservices(),或者你可以通過把一個intent傳遞給bindservice()來綁定一個service。 you can initiate a broadcast by passing anintentto methods likesendbroadcast(),send
35、orderedbroadcast(), orsendstickybroadcast().你可以通過傳遞一個intent給諸如sendbroadcast()、sendorderedbroadcast()或者sendstickybroadcast()等方法來初始化一個廣播。 you can perform a query to a content provider by callingquery()on acontentresolver.你可以通過調用contentresolver的query()方法來執(zhí)行一次contentprovider的查詢操作。for more information ab
36、out using intents, see theintents and intent filtersdocument. more information about activating specific components is also provided in the following documents:activities,services,broadcastreceiverandcontent providers. 更多關于使用intent的信息,查看intent和intentfilters文檔。更多關于如何激活特定的組件同樣在下面的文檔中提供:activities,serv
37、ices,broadcastreceiverandcontent providers. declaring components聲明組件the primary task of the manifest is to inform the system about the applications components. for example, a manifest file can declare an activity as follows:manifest的首要的任務就是聲明系統(tǒng)中有關這個應用的組件。例如,一個manifest文件可以通過聲明一個activity如下: . in theel
38、ement, theandroid:iconattribute points to resources for an icon that identifies the application.在這個元素中android:icon屬性指向一個資源(用來表示當前這個應用程序的圖標)in theelement, theandroid:nameattribute specifies the fully qualified class name of theactivitysubclass and theandroid:labelattributes specifies a string to use
39、as the user-visible label for the activity.在 這個元素中,android :name屬性用于確定繼承activity的的子類的全路徑名android:label屬性用于表示這個用戶可見的標簽 you must declare all application components this way:你必須通過一下的方法來聲明這些應用組件l elements for activitiesl elements for servicesl elements for broadcast receiversl elements for content provi
40、dersactivities:標簽services:標簽broadcastreceiver:標簽contentproviders:標簽activities, services, and content providers that you include in your source but do not declare in the manifest are not visible to the system and, consequently, can never run. however, broadcast receivers can be either declared in the
41、 manifest or created dynamically in code (asbroadcastreceiverobjects) and registered with the system by callingregisterreceiver().如果你的程序中用到了活動,服務,內容提供者但是沒有在manifest中聲明,結果是這些組件不會被系統(tǒng)所知道從而不會運行。但是,broadcast receivers 既可以在manifest中聲明也可以動態(tài)的通過代碼來創(chuàng)建(作為broadcast receivers對象)并且使用registerreceiver()在系統(tǒng)中注冊 decla
42、ring component capabilities聲明組件的能力as discussed above, inactivating components, you can use anintentto start activities, services, and broadcast receivers. you can do so by explicitly naming the target component (using the component class name) in the intent. however, the real power of intents lies i
43、n the concept of intent actions. with intent actions, you simply describe the type of action you want to perform (and optionally, the data upon which youd like to perform the action) and allow the system to find a component on the device that can perform the action and start it. if there are multipl
44、e components that can perform the action described by the intent, then the user selects which one to use.就像上面說的那樣,在激活組件的時候,你可以使用intent來開始活動,服務,內容提供者。你可以明確的在intent中聲明目標組件的名稱(使用組件的類名)。但是,intent的真正的能力取決于intent的action的概念,你可以簡單的描述你要操作的動作的類型(或者是有選擇的描述你要的在動作中使用的數(shù)據(jù)),并且可以允許系統(tǒng)找到一個在設備上組件執(zhí)行和啟動它。如果有多個在intent中描述能
45、執(zhí)行動作的組件,則可以讓用戶去選擇自己想用的the way the system identifies the components that can respond to an intent is by comparing the intent received to theintent filtersprovided in the manifest file of other applications on the device.系統(tǒng)識別能對intent做出響應的方式是通過比較接收到的intent和設備中應用程序的manifest文件中的intent filterswhen you dec
46、lare a component in your applications manifest, you can optionally include intent filters that declare the capabilities of the component so it can respond to intents from other applications. you can declare an intent filter for your component by adding anelement as a child of the components declarat
47、ion element.當你在應用的manifest中聲明一個組件時,你可以有選擇的包含intent filters,這些intent filters表明了這些組件對其他應用程序的intent做出反應的能力。你可以通過添加一個作為 來為你的組件聲明一個intent filtersfor example, an email application with an activity for composing a new email might declare an intent filter in its manifest entry to respond to send intents (in
48、 order to send email). an activity in your application can then create an intent with the “send” action (action_send), which the system matches to the email applications “send” activity and launches it when you invoke the intent withstartactivity().例如:一個有處理新郵件activity的郵件應用也許可以聲明一個intent filter在它的man
49、ifest入口中來作為send intent(為了send email ),在你的應用中可以創(chuàng)建一個帶有發(fā)送的intent(action_send),當你用startactivity()調用這個intent,系統(tǒng)在郵件程序中匹配一個send的activity并且運行它for more about creating intent filters, see theintents and intent filtersdocument.declaring application requirements聲明運行程序所需要的條件there are a variety of devices powered
50、 by android and not all of them provide the same features and capabilities. in order to prevent your application from being installed on devices that lack features needed by your application, its important that you clearly define a profile for the types of devices your application supports by declar
51、ing device and software requirements in your manifest file. most of these declarations are informational only and the system does not read them, but external services such as google play do read them in order to provide filtering for users when they search for applications from their device.有多種多樣的設備
52、上運行著android系統(tǒng)并且不是所有的設別都提供相同的特征和能力,為了防止你的程序安裝在缺乏相應功能的設備上,在你的manifest未見中聲明硬件和軟件的要求(為了讓你的應用被不同的設備支持)變得尤為的重要。大多數(shù)這些信息和聲明并不會被系統(tǒng)讀取。但是其他的服務比如androidmarket卻會閱讀這些聲明來幫助通過通過自己的設備搜索軟件的用戶過濾軟件。for example, if your application requires a camera and uses apis introduced in android 2.1 (api level7), you should declar
53、e these as requirements in your manifest file. that way, devices that donothave a camera and have an android versionlowerthan 2.1 cannot install your application from google play.比如:你的應用需要照相和android 2.1的api,你應該在你的manifest文件中聲明這些要求。通過這種方法,這些沒有相機功能或者是android版本低于2.1的不能沖google play中安裝該應用however, you can
54、 also declare that your application uses the camera, but does notrequireit. in that case, your application must perform a check at runtime to determine if the device has a camera and disable any features that use the camera if one is not available.然而,你也可以在你的應用中使用相機,但是并不是需要它。在這個情況下,你的應用在運行時必須執(zhí)行一次檢查來確
55、定這個設備是否有相機。如果你的設備沒有相機,那么系統(tǒng)會使使用照相機的相關程序不可用here are some of the important device characteristics that you should consider as you design and develop your application:在你設計和開發(fā)你的應用程序的時候,這里是一些你應該考慮的重要的設備特征screen size and density屏幕尺寸和分辨率in order to categorize devices by their screen type, android defines tw
56、o characteristics for each device: screen size (the physical dimensions of the screen) and screen density (the physical density of the pixels on the screen, or dpidots per inch). to simplify all the different types of screen configurations, the android system generalizes them into select groups that make them easier to target.為了對屏幕類型進行分類。android為每個設備定義了2個重要的特征:屏幕大小和屏幕分辨率。為了簡化所有屏幕配置的不同類型,android系統(tǒng)把他們集中到一起去選擇來更好的去瞄準the screen sizes are: small, normal, large, and extra large.the screen densities are: low density, medium
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 工傷保險 申請書
- 三方協(xié)議申請書范文
- 天玥運維安全網(wǎng)關怎么重啟
- 大學生在校創(chuàng)業(yè)項目指南
- 小學二年級數(shù)學三位數(shù)加減三位數(shù)計算綜合自測口算題帶答案
- 供電外線安全施工方案怎么寫
- 世界環(huán)境日校園活動方案
- 2024年圣誕節(jié)服裝店活動方案
- 以人為本的教學設計
- 競聘崗位申請書
- 2025年枝江金潤源建設集團招聘筆試參考題庫含答案解析
- 危險化學品安全監(jiān)管培訓
- 病原生物學-人體寄生蟲學知到智慧樹章節(jié)測試課后答案2024年秋浙江大學
- 校園安全案例解析
- 2024-2030年中國醫(yī)療建筑工程行業(yè)發(fā)展?jié)摿巴顿Y戰(zhàn)略規(guī)劃分析報告
- 人工智能導論知到智慧樹章節(jié)測試課后答案2024年秋天津大學
- 校史館裝修工程施工方案
- 金融消保培訓
- 南師大學校介紹課件
- 《病理科(中心)建設與配置標準》
- 《校園廉潔教育》主題班會課件全文
評論
0/150
提交評論