




版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、附錄A 譯文安卓應用開發(fā)根底在Java編程語言編寫的Android應用程序的Android的SDK工具編譯代碼以及與任何數(shù)據(jù)和到一個Android的包,一個歸檔文件檔案資源的.apk后綴,所有的在一個單一的代碼.apk文件被認為是一個應用程序,是Android的文件,供電設備來安裝應用程序。一旦安裝在設備上,每個Android應用程序的生命在它自己的平安沙箱:而Android操作系統(tǒng)是一個多用戶Linux系統(tǒng)中,每個應用程序是一個不同的用戶。默認情況下,每個應用程序的系統(tǒng)分配一個唯一的Linux用戶ID該ID僅用于由系統(tǒng)是未知的應用程序,系統(tǒng)設置所有的應用程序中的文件權限,以便只有用戶ID分配
2、給該應用程序可以訪問它們。每個進程都有它自己的虛擬機VM,因此應用程序的代碼在從其他應用程序隔離運行。默認情況下,每個應用程序運行在它自己的Linux進程。Android的啟動過程時,應用程序的任何組件需要被執(zhí)行,然后關閉該進程時,它不再需要或恢復時,系統(tǒng)必須為其他應用程序的內(nèi)存。這樣一來,Android系統(tǒng)實現(xiàn)了最小特權原那么,也就是說,每個應用程序,默認情況下,只能訪問的組件,它需要做的工作,沒有更多,這將創(chuàng)立一個非常平安的環(huán)境,使應用程序無法訪問的,這就是它沒有給予許可制度的局部。但是,有一個應用程序的方法與其他應用程序和應用程序訪問系統(tǒng)效勞的數(shù)據(jù):這有可能為兩個應用程序安排共享相同的L
3、inux用戶ID,在這種情況下,它們能夠相互訪問的文件。為了節(jié)約使用相同的用戶ID系統(tǒng)資源,應用程序還可以安排運行在相同的Linux進程和共享同一個VM應用也必須使用相同的證書簽名。應用程序可以請求訪問權限,如用戶的聯(lián)系人,短信,可安裝存儲SD卡,攝像頭,藍牙等設備的數(shù)據(jù),所有應用程序的權限必須由用戶在安裝時授予。 這涵蓋了根本就如何Android應用程序在系統(tǒng)中存在這個文件的其余局部向您介紹:1、框架的核心組件定義應用程序。2、清單文件中聲明組件和應用程序所需的設備功能。3、資源是從應用程序代碼分開,并允許您的應用程序正常優(yōu)化的設備配置各種其行為。應用程序組件(Application Com
4、ponents) Android的核心功能之一就是一個應用程序可以使用其它應用程序的元素如果那個應用程序允許的話。比方說,如果你的應用程序需要一個圖片卷動列 表,而另一個應用程序已經(jīng)開發(fā)了一個合用的而又允許別人使用的話,你可以直接調(diào)用那個卷動列表來完成工作,而不用自己再開發(fā)一個。你的應用程序并沒有吸納 或鏈接其它應用程序的代碼,它只是在有需求的時候啟動了其它應用程序的那個功能局部。 為到達這個目的,系統(tǒng)必須在一
5、個應用程序的一局部被需要時啟動這個應用程序,并將那個局部的Java對象實例化。與在其它系統(tǒng)上的應用程序不同,Android應用程序沒有為應用準備一個單獨的程序入口比方說,沒有main()方法, 而是為系統(tǒng)依照需求實例化提供了根本的組件。共有四種組件類型:活動(Activities)一個 activity 代表用戶界面的一個獨立屏幕。例如,一個郵件應用程序應該有一個 activity 用于顯示新郵件列表,另一個 activity 用于撰寫一封郵件,還有一個 activity 用于讀取郵件。盡管所有 activitie 協(xié)同工作以構成郵件應用程序的用戶體驗,但彼此之間
6、相對獨立。應次,不同的應用程序能夠從任何一個 activity 啟動 (只要郵件應用程序允許)。例如,用戶需要分享一張照片,一個拍照應用程序能夠啟動郵件應用程序的 activity 。activity 是一個實現(xiàn)了 Activity 的子類,你可以在 Activities 開發(fā)者指導局部了解更多。效勞(Services)service 是在后臺運行,執(zhí)行長時間操作或者執(zhí)行遠程操作。 service 不提供用戶界面。例如,當用戶在另一個應用程序時,一個 service 可在后臺播放音樂,或者是從網(wǎng)絡上獲取數(shù)據(jù),而不阻斷用戶與當前 activity
7、 的交互。其他組件,比方一個 activity ,為了與該 service 互動,可以啟動或者 綁定它。service 是一個實現(xiàn)了 Service 的子類,你可以在 Services 開發(fā)者指導局部了解更多。 播送接收器(Broadcast receivers)播送接收器是一個專注于接收播送通知信息,并做出對應處理的組件。很多播送是源自于系統(tǒng)代碼的比方,通知時區(qū)改變、電池電量低、拍攝了一張照片或者用戶改變了語言選項。應用程序也可以進行播送比方說,通知其它應用程序一些數(shù)據(jù)下載完成并處于可用狀態(tài)。應用程序可以擁有任意數(shù)量的播送接收器以對
8、所有它感興趣的通知信息予以響應。所有的接收器均繼承自BroadcastReceiver基類。播送接收器沒有用戶界面。然而,它們可以啟動一個activity來響應它們收到的信息,或者用NotificationManager來通知用戶。通知可以用很多種方式來吸引用戶的注意力閃動背燈、震動、播放聲音等等。一般來說是在狀態(tài)欄上放一個持久的圖標,用戶可以翻開它并獲取消息。內(nèi)容提供者(Content providers)內(nèi)容提供者將一些特定的應用程序數(shù)據(jù)供應其它應用程序使用。數(shù)據(jù)可以存儲于文件系統(tǒng)、SQLite數(shù)據(jù)庫或其它方式。內(nèi)容提供者繼承于ContentProvider 基類,為其它應用程序
9、取用和存儲它管理的數(shù)據(jù)實現(xiàn)了一套標準方法。然而,應用程序并不直接調(diào)用這些方法,而是使用一個ContentResolver 對象,調(diào)用它的方法作為替代。ContentResolver可以與任意內(nèi)容提供者進行會話,與其合作來對所有相關交互通訊進行管理。參閱獨立的內(nèi)容提供者Content Providers 章節(jié)獲得更多關于使用內(nèi)容提供者的內(nèi)容。每當出現(xiàn)一個需要被特定組件處理的請求時,Android會確保那個組件的應用程序進程處于運行狀態(tài),或在必要的時候啟動它。并確保那個相應組件的實例的存在,必要時會創(chuàng)立那個實例。Android系統(tǒng)設計的一個獨特方面是任何的一個程序都可以啟動另一
10、程序的組件。比方,你想讓你的程序可以使用照相機拍照,如果已經(jīng)有了實現(xiàn)這種功能的程序并且你你的程序能使用它有權限,那么你就沒有再要再寫一個新的Activity來實現(xiàn)這個功能。你的程序不需要包含或者鏈接這個拍照程序。相反,你只需要在你的程序中翻開這個拍照程序中的實現(xiàn)拍照功能的Activity。當拍完之后,拍好的照片甚至會自動返回給你的程序。者對于用戶來說,就好似是想拍照功能的程序就是你的這個程序的一局部一樣。當系統(tǒng)啟動一個組件之后,如果這個組件所在的程序之前沒有運行的話,系統(tǒng)會自動開始這個程序的進程,并初始化這個組件所需要的相關類。比方,你的程序開啟了一個拍照功能程序的Activity,這時系統(tǒng)會
11、啟動這個Activity所在的程序,所以這個Activity運行在拍照功能的程序當中,而不是在你的程序中。所以,不像其他操作系統(tǒng)的中的程序一樣,Android程序沒有一個單獨的入口點比方?jīng)]有我們常見的main()函數(shù)。 因為系統(tǒng)中的程序運行在自己的獨立進程中,并且程序中的文件都有自己的限制其他程序訪問的權限,所以,你的程序不能直接激活其他程序中的組件。但是Android系統(tǒng)就可以。具體是這樣的實現(xiàn)的,為了激活activate其他程序中的組件,你必須向系統(tǒng)發(fā)送一個消息來詳細說明你要啟動其他組件的意圖,這樣系統(tǒng)才會為你激活這個組件。 激活組件
12、(Activating Components)四大組件中的三個組件activities、services和broadcast receiver是由一種叫intent的異步消息來激活的。這些intents在運行時runtime將這些屬于你的程序或不同程序的單獨的組件綁定在一起bind,你可以把這些intents看作是需要其他組件的action的messengers。一個intent就是一個Intent對象,這個intent定義了一種可以激活activate某個特定組件或者某種特定類型的組件,這兩種情況分別對應兩種intent的定義方式或者顯示的或者隱式的。對于activities和se
13、rvices,一個intent定義了要執(zhí)行的操作action(比方,要“view或者“send什么)和要操作的數(shù)據(jù)的URI。比方,一個intent可能會為一個activity傳遞一個請求來展示一張圖片或者翻開一個網(wǎng)頁。有時,你可以啟動一個activity來得到返回的結果,在這個例子中這個activity的返回的結果也是一個Intent比方,你可以發(fā)送一個intent讓用戶選擇一個personal contact并返回給你這個返回的intent就包含了一個指向用戶選擇的聯(lián)系人的URI。關于activity和service的啟動方式,下面將介紹。對于播送接收者來說,intent只是簡單的
14、定義了要播送的內(nèi)容比方,一個用以說明電池電量很低的播送僅包含了一個說明電池電量很低的字符串。最后一種組件類型content provider并不是由intent來激活的activate。而是由接收到ContentResolver的請求時激活的。它們都各自有自己的方法來激活相應的組件:你可以通過傳遞一個Intent給startActivity()或startActivityForResult()啟動一個activity或者給他一些新的要做的內(nèi)容。使用startActivityForResult()你將得到一個返回結果。你可以通過傳遞一個Intent給startService()來sta
15、rt一個service或者給一個正在運行的service一些新的指令(instructions)?;蛘吣憧梢酝ㄟ^把一個Intent傳遞給bindService()來綁定一個service。你可以通過傳遞一個Intent給諸如sendBroadcast()、sendOrderedBroadcast()或者sendStickyBroadcast()等方法來初始化一個播送。你可以通過調(diào)用ContentResolver的query()方法來執(zhí)行一次content provider的查詢操作。更多的關于intent的內(nèi)容,可以參看文檔中的Intents and Intent
16、 Filters。更多的關于激活特定組件的內(nèi)容可以參看文檔中的:Activities、Services、BroadcastReceiver、Content Providers。關于Manifest文件在Android系統(tǒng)可以啟動一個應用程序組件之前,Android系統(tǒng)必須通過讀取這個程序的AndroidManifest.xml即manifest文件文件來確定要啟動的組件存在。你的程序必須在這個manifest文件聲明用到的所有的組件,并且這個manifest文件必須在工程的根目錄下。另外,這個manifest文件還聲明一些其他的東西,比方:確定這個程序需要的所有權限,比方I
17、nternet訪問權限或者讀取用戶聯(lián)系人權限。聲明這個運行這個程序所需要的最低API版本,這個可以根據(jù)開發(fā)該程序所使用的API版本。聲明該程序所需要的硬件或軟件特征features,比方照相機、藍牙效勞或者多點觸屏。聲明該程序需要鏈接link against的API庫不是Andorid的framework APIs,比方Google Maps library。組件聲明Manifest文件的首要任務就是通知系統(tǒng)關于程序中要使用的組件。比方,一個manifest文件可以用如下的方式來聲明一個activity:java view plaincopy1
18、. <?xml version="1.0" encoding="utf-8"?> 2. <manifest . > 3. <application android:icon="drawable/app_icon.png" . > 4. <activity android:name="ject.ExampleAc
19、tivity" 5. android:label="string/example_label" . > 6. </activity> 7. . 8. </application> 9
20、. </manifest> 在<application>元素中,android:icon屬性用于指定一個用于標示該程序的icon。在<activity>元素中,android:name屬性用于確定這個擴展自Activity的子類的全路徑名,android:label屬性用于標示這個activity的對于用戶可見的label。你必須要用以下方式來聲明你的程序組件:1、 activities:<activity>標簽2、 services:<service>標簽3、 broadcast receiver:&
21、lt;receiver>標簽4、 content providers:<provider>標簽如果程序中用到activities、services和content providers,你沒有在manifest文件中聲明,那么這些組件將不會被系統(tǒng)知道,結果就是你的程序不能運行。然而,broadcast receiver既可以在manifest文件中聲明也可以在代碼中動態(tài)創(chuàng)立BroadcastReceiver,并通過調(diào)用registerReceiver()在系統(tǒng)中注冊。更多關于怎樣為你的程序構建manifest文件,請參看文檔The And
22、roidManifes.xml文件。聲明組件的能力正如在上面Activating Components中討論的那樣,你可以使用一個Intent來啟動activities、services和broadcast receiver。你可以通過在intent中注明目標組件的名字使用的是組件的類名來顯示的啟動組件。然而,intents真正強大的地方在與關于intent的actions的概念。通過intent的actions,你可以簡單的描述你要執(zhí)行的操作的類型并且可以有選擇的描述你要處理的數(shù)據(jù),可以允許系統(tǒng)在device中找到這個組件并啟動它。如果有多個組件可以執(zhí)行intent中描述
23、的action,這時用戶就可以選擇一個來執(zhí)行。系統(tǒng)可以識別能對某intent做出反響的方式是通過將接收到的intent和設備中其他程序的manifest文件的intent filters進行比擬實現(xiàn)的。當你在程序的manifest文件中聲明一個組件之后,你可以有選擇包含intent filters,這些intent filters說明了組件對接收自其他程序的intent做出反響的能力capabilities。你可以通過添加一個<intent-filter>元素作為a child of the component&
24、#39;s declaration element來為你的程序聲明一個intent filter。比方,在一個郵件程序中的一個activity可以編寫新的郵件,這樣的話你就需要在manifest文件中來聲明一個intent filter來對“發(fā)送intent響應為了發(fā)送郵件。這樣,在你的程序中,一個activity就可以創(chuàng)立一個發(fā)送intent(ACTION_SEND),這樣當你調(diào)用startaActivity()時,系統(tǒng)就會匹配郵件程序中的發(fā)送activity并啟動它。更多關于創(chuàng)立intent filters的內(nèi)容,可以參看Intents
25、160;and Intent Filter文檔。聲明運行程序所需的條件Andorid系統(tǒng)可以支持很多不同的設備,并且這些設備的性能特征并不相同。為了防止你的程序被安裝在不能正常運行你的程序的較低android系統(tǒng)版本上,通過在manifest文件中聲明你的程序支持的設備和軟件,便變得尤其重要起來。大多數(shù)的這些聲明僅是一些信息,而系統(tǒng)并不會讀取它們,但是其他的效勞比方Android Market卻會閱讀這些聲明來幫助通過通過自己的設備搜索軟件的用戶過濾軟件。比方,你的程序需要照相機,并且使用的Android2.1的APIs,那么你就必須在你的manifest文件中聲
26、明這些需要。這樣的話,在Android Market上,沒有照相機或者Android系統(tǒng)版本低于2.1將不能安裝你的程序。然而,如果你的程序不需要照相機,你仍可以聲明你需要照相機。這種情況下,你的程序必須在運行時做一下檢查,來檢查這個設備是否含有照相機,如果沒有照相機可用,那么系統(tǒng)將會使使用照相機的相關程序不能用。下面是一些你在設計和開發(fā)你的程序時,必須要考慮的關于設備的一些重要方面:屏幕大小和分辨率:為了根據(jù)屏幕的類型進行分類,Android定義了兩個特征:屏幕大小和分辨率。屏幕尺寸有: 小,中,大,超大;屏幕分辨率類型:低分辨率,中分辨率,高分辨率,超高分辨率;默認情況
27、下,你的程序可以兼容所有的屏幕尺寸和分辨率,因為Android系統(tǒng)對你的程序的UI布局和image資源做了適當?shù)恼{(diào)整。輸入方式:很多設備有不同類型的輸入方式,比方鍵盤、軌跡球、五位元導航。如果你的程序需要某特定形式的輸入方式,那么你必須在manifes文件中使用<uses-configuration>標簽來聲明。不過這種情況是比擬少的。設備配置:有許多硬件或軟件并不全在Android系統(tǒng)的設備上,比方,一個照相機、光線傳感器、某個版本的 OpenGL,或者屏幕的保真度fidelity。你在任何條件下都不能假定Android設備具備某種特性feature當然得除掉Android標準庫
28、的情況,所以如果你的程序使用了某feature,那么你必須使用<uses-feature>標簽來聲明。不同地 Android 平臺設備通常運行不同版本的 Android ,比方 Android 1.6 或者 Android 2.3。每個后續(xù)版本通常包含之前版本所不支持的新增 API。 In order to indicate which set of APIs are available, 每個平臺版本對應一個 API Level (例如, Android 1.0 對應于 API Level 1 , Android 2.3 對應于 API L
29、evel 9)。如果你使用任何在 1.0 版之后平臺新增的 API,你應該使用 <uses-sdk> 元素聲明最低 API Level 是包含這些 API的。為你的應用程序聲明所有這些要求至關重要,因為,當你在 Android Market 上發(fā)布你的應用程序時,Market 使用這些聲明來過濾該應用程序是否對于每臺設備可用。 這樣,你的應用程序僅對能夠滿足你的應用程序要求的設備可用。應用程序資源一個應用程序不僅僅由代碼組成它需要區(qū)別于源代碼的資源,比方圖片,音頻文件,以及任何與應用程序視覺呈現(xiàn)相關聯(lián)的內(nèi)容。例如,你應該使用
30、160;XML 文件定義動畫,菜單,風格,顏色,以及 activity 用戶界面的布局。 使用應用程序資源文件,可以更容易地更新你的應用程序的特性而無需修改代碼,并且 通過提供多套可替換資源文件 使您能夠針對各種設備配置優(yōu)化你的應用程序(比方不同語言或屏幕大小)。對于你的安卓工程里面包含的每一項資源, SDK 構建工具定義一個唯一的正整數(shù) ID 標識符,你可以使用該標識符從你的應用程序代碼中或者從XML文件中定義的其他資源中特指該資源。例如,如果你的應用程序中包含一個名為 logo.png 圖片文件(保存在 res/drawable/ 文件夾
31、里), SDK 工具會生成一個資源 ID 命名為 R.drawable.logo,你可以使用該 ID 特指這張圖片并插入你的用戶界面中。將資源提供工作同你的源代碼分隔開來最重要的原因之一是能夠使您為不同的設備配置提供可替換的資源文件。例如,在 XML 中定義 UI 字符串,你可以將這些字符串翻譯成其他語言并保存在特定的文件夾中。然后,基于語言 qualifier / 修飾詞 你添加資源文件夾名稱 (比方 res/values-fr/ 對應于法語字符串) 以及用戶語言設置, Android 系統(tǒng)會給你的 UI
32、提供適當?shù)恼Z言字符串。對于你的可替代資源,Android 支持許多不同的 qualifiers / 修飾符 。修飾符是包含在你的資源文件夾名稱中的一個短字符串,以便界定哪些設備配置可使用這些資源。 另一個例子,對于不同的設備屏幕和大小,你應當為你的 activities 創(chuàng)立不同的布局。 例如,當設備屏幕是縱向的 (高),你可能希望一個按鈕垂直排列的布局,但當屏幕是橫向的(寬),按鈕應當水平排列。為了根據(jù)方向調(diào)整布局,你可以定義兩個不同的布局文件并給每個布局文件夾提供適當?shù)男揎椃?。這樣,系統(tǒng)會根據(jù)特定的設備方向自動為其提供適當?shù)牟季?。附錄B 外文原文Android Appl
33、ication FundamentalsWriter. Android applications are written in the Java programming language. The Android SDK tools compile the codealong with any data and resource filesinto an Android package, an archive file with an .apk suffix. All the code in a single .apk file is cons
34、idered to be one application and is the file that Android-powered devices use to install the application.Once installed on a device, each Android application lives in its own security sandbox:The Android operating system is a multi-user Linux system in which each application is a different user.By d
35、efault, the system assigns each application a unique Linux user ID (the ID is used only by the system and is unknown to the application). The system sets permissions for all the files in an application so that only the user ID assigned to that application can access them.Each process has its own vir
36、tual machine (VM), so an application's code runs in isolation from other applications.By default, every application runs in its own Linux process. Android starts the process when any of the application's components need to be executed, then shuts down the process when it's no longer need
37、ed or when the system must recover memory for other applications.In this way, the Android system implements the principle of least privilege. That is, each application, by default, has access only to the components that it requires to do its work and no more. This creates a very secure environm
38、ent in which an application cannot access parts of the system for which it is not given permission.However, there are ways for an application to share data with other applications and for an application to access system services:It's possible to arrange for two applications to share the same Lin
39、ux user ID, in which case they are able to access each other's files. To conserve system resources, applications with the same user ID can also arrange to run in the same Linux process and share the same VM (the applications must also be signed with the same certificate).An application can reque
40、st permission to access device data such as the user's contacts, SMS messages, the mountable storage (SD card), camera, Bluetooth, and more. All application permissions must be granted by the user at install time.That covers the basics regarding how an Android application exists within the syste
41、m. The rest of this document introduces you to:1、The core framework components that define your application.2、The manifest file in which you declare components and required device features for your application.3、Resources that are separate from the application code and allow your application to grac
42、efully optimize its behavior for a variety of device configurations. Application ComponentsApplication components are the essential building blocks of an Android application. Each component is a different point through which the system can enter your application. Not all components are actual entry
43、points for the user and some depend on each other, but each one exists as its own entity and plays a specific roleeach one is a unique building block that helps define your application's overall behavior.There are four different types of application components. Each type serves a distinct purpos
44、e and has a distinct lifecycle that defines how the component is created and destroyed.Here are the four types of application components:ActivitiesAn activity represents a single screen with a user interface. For example, an email application might have one activity that shows a list of ne
45、w emails, another activity to compose an email, and another activity for reading emails. Although the activities work together to form a cohesive user experience in the email application, each one is independent of the others. As such, a different application can start any one of these activities (i
46、f the email application allows it). For example, a camera application can start the activity in the email application that composes new mail, in order for the user to share a picture.An activity is implemented as a subclass of Activity and you can learn more about it in the Activities
47、 developer guide.ServicesA service is a component that runs in the background to perform long-running operations or to perform work for remote processes. A service does not provide a user interface. For example, a service might play music in the background while the user is in a diffe
48、rent application, or it might fetch data over the network without blocking user interaction with an activity. Another component, such as an activity, can start the service and let it run or bind to it in order to interact with it.A service is implemented as a subclass of Service and you ca
49、n learn more about it in the Services developer guide.Content providersA content provider manages a shared set of application data. You can store the data in the file system, an SQLite database, on the web, or any other persistent storage location your application can access. Thr
50、ough the content provider, other applications can query or even modify the data (if the content provider allows it). For example, the Android system provides a content provider that manages the user's contact information. As such, any application with the proper permissions can query part of the
51、 content provider (such as ) to read and write information about a particular person.Content providers are also useful for reading and writing data that is private to your application and not shared. For example, the Note Pad sample application uses a content provider to save notes.A
52、content provider is implemented as a subclass of ContentProvider and must implement a standard set of APIs that enable other applications to perform transactions. For more information, see the Content Providers developer guide.Broadcast receiversA broadcast receiver is
53、a component that responds to system-wide broadcast announcements. Many broadcasts originate from the systemfor example, a broadcast announcing that the screen has turned off, the battery is low, or a picture was captured. Applications can also initiate broadcastsfor example, to let other application
54、s know that some data has been downloaded to the device and is available for them to use. Although broadcast receivers don't display a user interface, they may create a status bar notification to alert the user when a broadcast event occurs. More commonly, though, a broadcast receiver
55、is just a "gateway" to other components and is intended to do a very minimal amount of work. For instance, it might initiate a service to perform some work based on the event.A broadcast receiver is implemented as a subclass of BroadcastReceiver and each broadcast is delivered as
56、 an Intent object. For more information, see the BroadcastReceiver class.A unique aspect of the Android system design is that any application can start another applications component. For example, if you want the user to capture a photo with the device camera, there's probably ano
57、ther application that does that and your application can use it, instead of developing an activity to capture a photo yourself. You don't need to incorporate or even link to the code from the camera application. Instead, you can simply start the activity in the camera application that captures a
58、 photo. When complete, the photo is even returned to your application so you can use it. To the user, it seems as if the camera is actually a part of your application.When the system starts a component, it starts the process for that application (if it's not already running) and instantiates the
59、 classes needed for the component. For example, if your application starts the activity in the camera application that captures a photo, that activity runs in the process that belongs to the camera application, not in your application's process. Therefore, unlike applications on most other syste
60、ms, Android applications don't have a single entry point (there's no main() function, for example).Because the system runs each application in a separate process with file permissions that restrict access to other applications, your application cannot directly activate a component
61、from another application. The Android system, however, can. So, to activate a component in another application, you must deliver a message to the system that specifies your intent to start a particular component. The system then activates the component for you.Activating ComponentsThree of
62、 the four component typesactivities, services, and broadcast receiversare activated by an asynchronous message called an intent. Intents bind individual components to each other at runtime (you can think of them as the messengers that request an action from other components), whether the component belongs to your application or another.An intent is created with an Intent object, which defines a message to activ
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 廚房用品設計
- 西方管理會計發(fā)展歷程
- 支付隱私保護技術-第2篇-洞察及研究
- 中班健康水果營養(yǎng)多課件
- 中班健康教育課件《咪咪吃魚》
- 2025-2030中國狗罐頭食品行業(yè)市場發(fā)展趨勢與前景展望戰(zhàn)略研究報告
- 2025-2030中國油浸式負荷開關行業(yè)市場發(fā)展趨勢與前景展望戰(zhàn)略研究報告
- 2025-2030中國母嬰營養(yǎng)品行業(yè)發(fā)展趨勢與投資戰(zhàn)略研究報告
- 2025-2030中國暖器箱行業(yè)發(fā)展分析及投資風險預測研究報告
- 從游戲走向課堂:VR沉浸式數(shù)學教學模式研究
- 私企退休員工管理辦法
- 2025年地區(qū)事業(yè)單位招聘公共基礎知識重點難點突破試題
- 2025變壓器類產(chǎn)品型號注冊管理
- 推進教師跨學科教學能力提升方案
- 職業(yè)院校與企業(yè)深度合作2025年校企合作人才培養(yǎng)質(zhì)量提升策略與實踐報告
- 2025黨考試題及答案
- 曲臂高空作業(yè)車安全操作規(guī)程
- 北京玉淵潭中學初一新生分班(摸底)數(shù)學模擬考試(含答案)【6套試卷】
- A型肉毒素注射美容記錄
- 中職 物聯(lián)網(wǎng) 試講題目2
- 高處作業(yè)審批表
評論
0/150
提交評論