Android外文翻譯(Android中英文獻)_第1頁
Android外文翻譯(Android中英文獻)_第2頁
Android外文翻譯(Android中英文獻)_第3頁
Android外文翻譯(Android中英文獻)_第4頁
Android外文翻譯(Android中英文獻)_第5頁
已閱讀5頁,還剩13頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、 本科畢業(yè)設(shè)計(論文)外文參考文獻譯文及原文學(xué) 院 信息工程學(xué)院 專 業(yè) 測控技術(shù)與儀器 (光機電一體化方向) 年級班別 2011級(1)班 學(xué) 號 學(xué)生姓名 指導(dǎo)教師 2015年 6 月目 錄1 應(yīng)用程序基礎(chǔ)11.1 應(yīng)用程序組件11.2激活組件:intent31.3關(guān)閉組件41.4manifest文件51.5intent過濾器61.6基于xml的布局71 application fundamentals 81.1 application components81.2activating components:intent111.3shutting down components121.4t

2、he manifest file131.5intent filters141.6xml-based layout151 應(yīng)用程序基礎(chǔ)android應(yīng)用程序使用java編程語言開發(fā)。aapt工具把編譯后的java代碼連同應(yīng)用程序所需的其他數(shù)據(jù)和資源文件一起打包到一個android包文件中,這個文件使用.apk作為擴展名。此文件是分發(fā)并安裝應(yīng)用程序到移動設(shè)備的載體;是用戶下載到他們的設(shè)備的文件。單一.apk文件中的所有代碼被認(rèn)為是一個應(yīng)用程序。從多個角度來看,每個android應(yīng)用程序都存在于它自己的世界之中:1 默認(rèn)情況下,每個應(yīng)用程序均運行于它自己的linux進程中。當(dāng)應(yīng)用程序中的任何代碼需要

3、被執(zhí)行時,android啟動此進程,而當(dāng)不再需要此進程并且其它應(yīng)用程序又請求系統(tǒng)資源時,則就關(guān)閉了這個進程。 2 每個進程都有其獨有的虛擬機(vm),所以應(yīng)用程序代碼與所有其它應(yīng)用程序代碼是隔離運行的。 3 默認(rèn)情況下,每個應(yīng)用程序均被賦予一個唯一的linux用戶id,并加以權(quán)限設(shè)置,使得應(yīng)用程序的文件僅對此用戶及此應(yīng)用程序可見盡管也有其它的方法使得這些文件同樣能為其他應(yīng)用程序所訪問。 1.1 應(yīng)用程序組件android的一個核心的特性就是一個應(yīng)用程序可以使用其它應(yīng)用程序的元素(如果那個應(yīng)用程序允許的話)。例如,如果你的應(yīng)用程序需要顯示一個圖片卷動列表,而另一個應(yīng)用程序已經(jīng)開發(fā)了一個合用的而又

4、允許別的應(yīng)用程序使用的話,你可以直接調(diào)用那個卷動列表來完成工作,而不用自己再開發(fā)一個。你的應(yīng)用程序并沒有吸納或鏈接其它應(yīng)用程序的代碼。它只是在有需求的時候啟動了其它應(yīng)用程序的那個功能部分。 為達到這個目的,系統(tǒng)必須能夠在一個應(yīng)用程序的任何一部分被需要時啟動一個此應(yīng)用程序的進程,并將那個部分的java對象實例化。因此,不像其它大多數(shù)系統(tǒng)上的應(yīng)用程序,android應(yīng)用程序并沒有為應(yīng)用程序提供一個單獨的入口點(比如說,沒有main()函數(shù)),而是為系統(tǒng)提供了可以實例化和運行所需的必備組件。一共有四種組件類型: (1)activity activity是為用戶操作而展示的可視化用戶界面。例如,一個a

5、ctivity可以展示一個菜單項列表供用戶選擇,戒者顯示一些包含說明文字的照片。一個短消息應(yīng)用程序可以包括一個用于顯示要發(fā)送消息到的聯(lián)系人列表的activity,一個給選定的聯(lián)系人寫短信的activity以及翻閱以前的短信或改變設(shè)置的其他activity。盡管它們一起組成了一個內(nèi)聚的用戶界面,但其中每個activity都不其它的保持獨立。每一個都實現(xiàn)為以activity類為基類的子類。 一個應(yīng)用程序可以只有一個activity,戒者,如剛才提到的短信應(yīng)用程序那樣,包含很多個。每個activity的作用,以及有多少個activity,當(dāng)然是取決于應(yīng)用程序及其設(shè)計的。一般情況下,總有一個應(yīng)用程序被

6、標(biāo)記為用戶在應(yīng)用程序啟動的時候第一個看到的。從一個activity轉(zhuǎn)向另一個靠的是用當(dāng)前的activity啟動下一個。 每個activity都被給予一個默認(rèn)的窗口以進行繪制。一般情況下,這個窗口是滿屏的,但它也可以是一個小的位于其它窗口之上的浮動的窗口。一個activity也可以使用附加的窗口例如,一個在activity運行過程中彈出的供用戶響應(yīng)的對話框,這是一個當(dāng)用戶選擇了屏幕上特定項目后顯示的必要信息的窗口。 窗口顯示的可視內(nèi)容是由一系列層次化view構(gòu)成的,這些view均繼承自 view 基類。每個view均控制著窗口中一塊特定的矩形區(qū)域。父級view包含并組織其子view的布局。葉節(jié)點

7、view(位于層次結(jié)構(gòu)最底端)在它們控制的矩形區(qū)域中進行繪制,并對用戶直達其區(qū)域的操作做出響應(yīng)。因此,view是activity與用戶進行交互的界面。例如,view可以顯示一個小圖片,并在用戶指點它的時候產(chǎn)生動作。android有一些預(yù)置的view供開發(fā)者使用包括按鈕、文本域、滾動條、菜單項、復(fù)選框等等。 view的層次結(jié)構(gòu)是由activity.setcontentview() 方法放入activity的窗口之中的。content view是位于層次結(jié)構(gòu)根位置的view對象。(參見獨立的用戶界面文檔以獲取關(guān)于view及層次結(jié)構(gòu)的更多信息。) (2) service service沒有可視化的用

8、戶界面,而是在一段時間內(nèi)在后臺運行。例如,一個service可以在用戶做其它事情的時候在后臺播放背景音樂、從網(wǎng)絡(luò)上獲取數(shù)據(jù)或者計算一些東西并提供給需要這個運算結(jié)果的activity使用。每個service都繼承自service基類。 一個媒體播放器播放播放列表中的曲目是一個不錯的例子。播放器應(yīng)用程序可能有一個或多個activity來給用戶選擇歌曲并進行播放。然而,音樂播放這個任務(wù)本身丌應(yīng)該由任何activity來處理,因為用戶的期望即使在他們離開播放器的應(yīng)用程序而已經(jīng)在開始做別的事情時,音樂仍然在繼續(xù)播放。為達到這個目的,媒體播放器activity可以啟動一個運行于后臺的service服務(wù)。系

9、統(tǒng)將在這個activity不再顯示于屏幕后,仍維持音樂播放的service的運行。 連接至(綁定到)一個正在運行的service(如果service沒有運行,則啟動之)是可能的。連接之后,你可以通過那個service暴露出來的接口不service進行通訊。對于音樂service來說,這個接口可以允許用戶暫停、回退、停止以及重新開始播放。 如同activity和其它的組件一樣,service服務(wù)運行于應(yīng)用程序進程的主線程內(nèi)。所以它不會對其它組件或者用戶界面有任何的妨礙作用,它們一般會派生一個新線程來執(zhí)行一些時間消耗型任務(wù)(比如音樂回放和網(wǎng)絡(luò)下載)。參見稍后的進程和線程介紹。 (3) broadc

10、astreceiver broadcast receiver是一個與注于接收廣播通知信息,并做出相應(yīng)處理的組件。許多廣播是由系統(tǒng)代碼產(chǎn)生的例如,通知時區(qū)改變、電池電量低、拍攝了一張照片或者用戶改變了語言選項。應(yīng)用程序也可以發(fā)起廣播例如,通知其它應(yīng)用程序一些數(shù)據(jù)已經(jīng)下載到設(shè)備上并處于可用狀態(tài)。 一個應(yīng)用程序可以擁有任意數(shù)量的broadcast receiver,以對所有它認(rèn)為重要的通知信息予以各種響應(yīng)。所有的receiver均繼承自broadcastreceiver基類。 broadcast receiver沒有用戶界面。然而,它們可以啟動一個activity或者service來響應(yīng)它們收到的信

11、息,當(dāng)然也可以使用notificationmanager來通知用戶。通知可以用多種方式來吸引用戶的注意力閃動背光燈、震動設(shè)備、播放聲音等等。通知一般是在狀態(tài)欄上放一個持麗的圖標(biāo),用戶可以點擊打開它并獲取所要消息。 (4)contentprovider content provider將一些特定的應(yīng)用程序數(shù)據(jù)供給其它應(yīng)用程序使用處理。數(shù)據(jù)可以存儲于文件系統(tǒng)、sqlite數(shù)據(jù)庫或其它有意丿的方式。content provider繼承于contentprovider 基類,實現(xiàn)了一套使得其他應(yīng)用程序能夠檢索和存儲它所管理的類型數(shù)據(jù)的標(biāo)準(zhǔn)方法。然而,應(yīng)用程序并不直接調(diào)用返些方法,而是使用一個 cont

12、entresolver 對象,調(diào)用它的方法作為替代。contentresolver可以與任何content provider進行會話;與其合作對任何相關(guān)的進程間通訊進行管理。 參閱獨立的content providers文檔以獲得更多關(guān)于使用content provider的信息。 每當(dāng)出現(xiàn)一個需要被特定組件處理的請求時,android會確保那個組件的應(yīng)用程序進程處于運行狀態(tài),必要時會啟動它,并確保那個組件的一個合適的實例可用,必要時會創(chuàng)建那個實例。 1.2激活組件:intent當(dāng)接收到contentresolver發(fā)出的請求后,content provider被激活。而其它三種組件activ

13、ity、service和broadcast receiver,被一種叫做intent的異步消息所激活。intent是一個保存著消息內(nèi)容的intent對象。對于activity和service來說,它指明了所請求的操作名稱,并指定了用來操作的數(shù)據(jù)的uri和其它一些信息。例如,它可以承載一個對一個activity的請求,讓它為用戶顯示一張圖片,或者讓用戶編輯一些文本。而對于broadcast receiver來說,intent對象指明了所通報的操作。例如,它可以對所有感興趣的對象通報照相按鈕被按下。 對于每種組件來說,激活的方法也是不同的: 1 通過傳遞一intentcontext.startac

14、tivity()activity.startactivityforresult(以啟動(或指定新工作給)另外一個activity。相應(yīng)的activity可以通過調(diào)用自身的 getintent() 方法來查看并且激活它的intent。android通過調(diào)用activity的onnewintent()方法來傳遞給它隨后的任何intent。 一個activity經(jīng)常啟動另一個activity。如果它期望它所啟動的那個activity返回一個結(jié)果,它會調(diào)用startactivityforresult()而不是startactivity()。例如,如果它啟動了另外一個activity以使用戶挑選一張自己

15、的照片,它也許想知道哪張照片被選中了。其結(jié)果將會被封裝在一個intent對象中,并傳遞給發(fā)出調(diào)用的activity的onactivityresult() 方法。 2 通過傳遞一個intent對象至context.startservice()以啟動一個service(或向正在運行的service給出一個新的指令)。android調(diào)用此service的 onstart()方法并將intent對象傳遞給它。 與此類似,一個intent可以被傳遞給 context.bindservice()以建立一個處于調(diào)用組件和目標(biāo)service乀間的活動連接。此service會通過onbind() 方法的調(diào)用來獲

16、取此intent對象(如果此service尚未運行,bindservice()會先啟動它)。例如,一個activity可以建立一個不前述的音樂回放service的連接,這樣它就可以提供給用戶一些途徑(用戶界面)來控制回放。這個activity可以調(diào)用 bindservice()來建立此連接,然后調(diào)用service中定之的方法來控制回放。 稍后的遠(yuǎn)程方法調(diào)用一節(jié)有關(guān)于如何綁定至一個service的更多細(xì)節(jié)。 3 應(yīng)用程序可以通過傳遞一個intent對象至 context.sendbroadcast() ,context. sendorderedbroadcast(), 以及context.sen

17、dstickybroadcast()和其它類似方法來發(fā)起一個廣播。android會調(diào)用所有對此廣播有興趣的broadcast receiver的 onreceive()方法,將此intent傳遞給它們。 1.3 關(guān)閉組件content provider僅在響應(yīng)來自contentresolver的請求時處于不同活動狀態(tài)。而broadcast receiver僅在響應(yīng)一條廣播信息的時候處于各種活動狀態(tài)。所以沒有必要去顯式地關(guān)閉這組件。 而activity則不同,它提供了用戶界面。只要會話依然持續(xù),無論會話過程有無空閑,activity同用戶進行長時間會話且可能一直處于活動狀態(tài)。與此相似,servi

18、ce也會在很長一段時間內(nèi)在后臺保持運行。所以android為關(guān)閉activity和service提供了一系列有序的方法。 activity可以通過調(diào)用自身的finish()方法來關(guān)閉。一個activity可以通過調(diào)用finishactivity()方法來關(guān)閉另外一個activity(它用startactivityforresult() 啟動的)。 service可以通過調(diào)用自身的stopself()方法,或調(diào)用 context.stopservice()來停止。 系統(tǒng)也會在組件不再被使用的時候戒者當(dāng)android必須為更多的活動組件回收內(nèi)存時關(guān)閉它。稍后的組件的生命的周期一節(jié),將對這種可能性及

19、結(jié)果進行更詳細(xì)的介紹討論。 1.4 manifest文件當(dāng)android啟動一個應(yīng)用程序組件之前,它必須知道那個組件是存在的。因此,應(yīng)用程序會在一個被打包到android包中的manifest文件中聲明它的組件,.apk文件還將涵括應(yīng)用程序的代碼、文件以及其它資源。 manifest文件是一個結(jié)構(gòu)化的xml文件,而且對于所有應(yīng)用程序,文件名總是androidmanifest.xml。除了聲明此應(yīng)用程序各個組件,它會做很多其他工作,比如指明應(yīng)用程序所需鏈接到的庫的名稱(除了默認(rèn)的android庫外)以及標(biāo)出應(yīng)用程序期望獲得的各種權(quán)限。 但manifest文件最重要的任務(wù)是向android報告此應(yīng)

20、用程序的各個組件。丼例說明,一個activity可能聲明如下: 元素的name屬性指定了實現(xiàn)此activity的 activity子類。icon和label屬性指向包含展示給用戶的此activity的圖標(biāo)和標(biāo)簽的資源文件。 其它組件也以類似的方法聲明 元素用于聲明service, 元素用于聲明broadcast receiver,而 元素用于聲明content provider。未在manifest文件中進行聲明的activity、service以及content provider將不為系統(tǒng)所見,從而也就永不會被運行。然而,broadcast receiver既可以在manifest文件中聲明

21、,也可以在代碼中動態(tài)創(chuàng)建(為broadcastreceiver對象),并以調(diào)用context.registerreceiver()的方式注冊至系統(tǒng)。 1.5 intent過濾器一個intent對象可以顯式地指定一個目標(biāo)組件。如果進行了返種指定,android會找到這個組件(基于manifest文件中的聲明)并激活它。但如果intent沒有顯式地指定一個目標(biāo),android就必須找到最合適的組件來響應(yīng)此intent。這個過程是通過比較intent對象和所有潛在目標(biāo)的intent過濾器完成的。組件的intent過濾器會通知android它所能處理的intent類型。如同組件的其它必要信息一樣,這些

22、intent過濾器是在manifest文件中進行聲明的。返里有一個對先前例子的擴展,其中加入了針對activity的兩個intent過濾器: 示例中的第一個過濾器action“ent.action.main”和category“ent.category.launcher”的組合是常見的一個。它標(biāo)明了此activity應(yīng)該在應(yīng)用程序啟動器中顯示,就是用戶在屏幕上看到的此設(shè)備上可供啟動的應(yīng)用程序的列表。換句話說,這個activity是應(yīng)用程序的入口點,是用戶在啟動器中選擇運行這個應(yīng)用程序后所見到的第一個activity。 第二個過濾器聲明了此activi

23、ty在一種特定類型的數(shù)據(jù)上可以執(zhí)行的操作。 一個組件可以擁有任意數(shù)量的intent過濾器,每個都聲明了一套不同的功能。如果組件沒有包含任何過濾器,它只能被顯式地指明作為目標(biāo)組件的intent激活。 對于在代碼中創(chuàng)建并注冊的broadcast receiver來說,intent過濾器將被直接實例化intentfilter為對象。其它所有的過濾器都在manifest文件中設(shè)置。 1.6基于xml的布局雖然純粹通過java代碼在activity上創(chuàng)建和添加部件,在技術(shù)上是可行的,我們在第4章中做的一樣,更常見的方法是使用一種基于xml的布局文件。動態(tài)的小部件實例保留更多,情況復(fù)雜,小工具在編譯時不為

24、人所知(例如,在數(shù)據(jù)檢索了互聯(lián)網(wǎng)基礎(chǔ)上將單選按鈕填充柱??紤]到這一點,現(xiàn)在是時候打破xml來學(xué)習(xí)如何用此種方式來布置android activities。正如其名稱所示,一個基于xml的布局是一個關(guān)系到每個規(guī)格的小部件,和他們的容器(更多關(guān)于此內(nèi)容的在第7章)編碼的xml格式。具體來說,android認(rèn)為基于xml的布局是資源,因此布局的文件存儲在res /在你的android項目布局目錄中。每個xml文件包含一個指定的部件和容器布局元素樹,一種意見認(rèn)為構(gòu)成層次。對xml元素的屬性,描述一個部件應(yīng)如何看或者一個容器應(yīng)如何運轉(zhuǎn)。例如,如果一個按鈕元素。有一個android的屬性值:文字樣式=“b

25、old”,這意味著該文本出現(xiàn)在按鈕的表面應(yīng)該是呈現(xiàn)一個粗體字體樣式.android的sdk中附帶一個使用的布局的工具(aapt)。這個工具應(yīng)自動調(diào)用你的android工具鏈(例如,eclipse中,ants build.xml)。作為一個開發(fā)人員,尤其重要的是,在您的項目中aapt生成r.java源文件,讓您能在那些布局中直接從java代碼中獲取布局和部件。xml作為一個gui定義格式是越來越流行普遍。微軟的xaml,adobe的flex,和mozilla的xul都采取android類似的方法:把布局細(xì)節(jié)放在一個xml文件和把編程智慧資料放在源文件(例如,xul中的javascript)。許多

26、不太知名的圖形用戶界面框架,如zk,還使用視圖定義的xml。而“隨大流”并不一定是最好的政策,但他們有優(yōu)勢幫助從任何其他xml為中心的觀點描述語言輕松進入android。1 application fundamentalsandroid 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

27、 an android package, an archive file marked by an .apk suffix. this file is the vehicle 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.in many ways, each androi

28、d application lives in its own world:1. by default, every application runs in its own linux process. android starts the process when any of the applications code needs to be executed, and shuts down the process when its no longer needed and system resources are required by other applications.2. each

29、 process has its own virtual machine (vm), so application code runs in isolation from the code of all other applications.3. by default, each application is assigned a unique linux user id. permissions are set so that the applications files are visible only to that user and only to the application it

30、self although there are ways to export them to other applications as well.its possible to arrange for two applications to share the same user id, in which case they will be able to see each others files. to conserve system resources, applications with the same id can also arrange to run in the same

31、linux process, sharing the same vm.1.1 application componentsa 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 another applicati

32、on 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 other application whe

33、n 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 everything in the a

34、pplication (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:(1)activitiesan activity presents a visual user interface for one focused endeavor the user can undertake. for example, an activi

35、ty 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, and other activ

36、ities 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 text messaging app

37、lication 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. moving from one a

38、ctivity to another is accomplished by having the current activity start the next one.each activity is given a default window to draw in. typically, the window fills the screen, but it might be smaller than the screen and float on top of other windows. an activity can also make use of additional wind

39、ows for example, a pop-up dialog that calls for a user response in the midst of the activity, or a window that presents users with vital information when they select a particular item on-screen.the visual content of the window is provided by a hierarchy of views objects derived from the base view cl

40、ass. each view controls a particular rectangular space within the window. parent views contain and organize the layout of their children. leaf views (those at the bottom of the hierarchy) draw in the rectangles they control and respond to user actions directed at that space. thus, views are where th

41、e activitys interaction with the user takes place.for example, a view might display a small image and initiate an action when the user taps that image. android has a number of ready-made views that you can use including buttons, text fields, scroll bars, menu items, check boxes, and more.a view hier

42、archy is placed within an activitys window by the activity.setcontentview() method. the content view is the view object at the root of the hierarchy. (see the separate user interface document for more information on views and the hierarchy.)(2)servicesa service doesnt have a visual user interface, b

43、ut rather runs in the background for an indefinite period of time. for example, a service might play background 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 servi

44、ce base class.a prime example is a media player playing songs from a play list. the player application would probably have one or more activities that allow the user to choose songs and start playing them. however, the music playback itself would not be handled by an activity because users will expe

45、ct the music to keep playing even after they leave the player and begin something different. to keep the music going, the media player activity could start a service to run in the background. the system would then keep the music playback service running even after the activity that started it leaves

46、 the screen.its possible to connect to (bind to) an ongoing service (and start the service if its not already running). while connected, you can communicate with the service through an interface that the service exposes. for the music service, this interface might allow users to pause, rewind, stop,

47、 and restart the playback.like activities and the other components, services run in the main thread of the application process. so that they wont block other components or the user interface, they often spawn another thread for time-consuming tasks (like music playback). see processes and threads, l

48、ater.(3)broadcast receiversa broadcast receiver is a component that does nothing but receive and react to broadcast announcements. many broadcasts originate in system code for example, announcements that the timezone has changed, that the battery is low, that a picture has been taken, or that the us

49、er changed a language preference. applications can also initiate broadcasts for example, to let other applications know that some data has been downloaded 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 consi

50、ders important. all receivers extend the broadcastreceiver base class.broadcast receivers do not display a user interface. however, they may start an activity in response to the information they receive, or they may use the notificationmanager to alert the user. notifications can get the users atten

51、tion 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, which users can open to get the message.(4)content providersa content provider makes a specific set of the applications data available to other app

52、lications. the data can be stored in the file system, in an sqlite database, 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.

53、however, applications do not call these methods directly. rather they use 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 provid

54、ers document for more information on using content providers.whenever 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 availab

55、le, creating the instance if necessary.1.2 activating components: intentscontent providers are activated when theyre targeted by a request from a contentresolver. the other three components activities, services, and broadcast receivers are activated by asynchronous messages called intents. an intent

56、 is an intent object that holds the content of the message. for activities and services, it names the action being requested and specifies the uri of the data to act on, among other things. for example, it might convey a request for an activity to present an image to the user or let the user edit so

57、me text. for broadcast receivers, theintent object names the action being announced. for example, it might announce to interested parties that the camera button has been pressed.there are separate methods for activating each type of component:1. an activity is launched (or given something new to do)

58、 by passing an intent object tocontext.startactivity() or activity.startactivityforresult(). the responding activity can look at the initial intent that caused it to be launched by calling its getintent() method. android calls the activitys onnewintent() method to pass it any subsequent intents. one activity often starts the next one. if it expects a result back from the activity its starting, it calls s

溫馨提示

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

最新文檔

評論

0/150

提交評論