安卓開發(fā)考試復習題含答案_第1頁
安卓開發(fā)考試復習題含答案_第2頁
安卓開發(fā)考試復習題含答案_第3頁
安卓開發(fā)考試復習題含答案_第4頁
安卓開發(fā)考試復習題含答案_第5頁
已閱讀5頁,還剩6頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、1 安卓核心組件有哪些 ? What are the Android core components? 提供界面顯示的 Activtiy, 提供后臺計算的 Service,提供進程間通信的Intent 提供廣播接收的 BroadcastRsceiver.2安卓key features有哪些?Intergrated browser SQLite Media support Wireless services DVM Application framework Rich development environment3 安卓用什么數據庫?Android with what database?SQL

2、ite4幾個流行的移動平臺各自的IDE是什么?IOS XcodeAndroid Eclipse Windows phone Visual Studio 黑莓 Native平臺5 R.java是什么文件?干什么用的?在什么地方? What is R.java file? What for? Inwhat place? |R.java文件是Android項目自動生成的終態(tài)類R.java文件除了有自動標識資源的"索引"功能之外,還有另一個主要的功能,當 "res"目 錄中的某個資源在應用中沒有被使用到,在該應用被編譯的時候系統(tǒng)就不會把對應的資源編譯到該應用的A

3、PK包中,這樣可以節(jié)省 Android手機的資源。"gen/"目錄下6 安卓平臺架構分為幾層?各是什么?The Android platform structure is divided intoseveral layers? Each is what?Android系統(tǒng)分為 四層,從下往上 分別是Linux Kernel, Libraries 和 Android Runtime, Application Framework,Applications.7創(chuàng)建一個UI并運行之,有哪幾個步驟? 創(chuàng)建一個Activity 把UI和Activity關聯起來 注冊這個Activity

4、8 Int ent有幾個組件?各是干什么用的?哪些組件是必須存在的,哪些是可選的,在Manifest中intent filter是如何聲明的?Componment name(接收者名字)Action(指定需要被執(zhí)行的動作)Data(指定用于操作的數據)Category(指定目標應用程序組件的行為)ExtrasFlags定義在activity<intent-filter></intent-filter>/activity9 Ac tivity的生命周期有哪些狀態(tài)?狀態(tài)轉換時調用的方法各是什么?What is the state of the Activity life c

5、ycle? State transitionmethod called when all is what?一個Activity有三種狀態(tài):Running,運行在前臺(在當前Activity棧的棧頂)。Paused,失去了焦點但是仍然對用戶可見,比如有其他的 Activity在它之上,或者透明或者沒有遮住整個屏幕。Stopped,被其他Activity完全覆蓋,需要注意的是包括暫停狀態(tài)在內,這兩種狀態(tài)都仍然保存了所有狀態(tài)信息,直到被系統(tǒng)終止。1 void onCreate()2 void onStart()3 void onRestart()4 void onResume()5 void onP

6、ause()6 void onStop()7 void onDestroy()10同一個應用之間 Activity 互相調用要用什么Intent (隱式、顯式?還是什么?)?With an application of the Activity call each other to usewhat Intent (implicit, explicit? Or what?)?顯式Intent直接用組件的名稱定義目標組件 ,這種方式很直接。但是由于開發(fā)人員往往 并不清楚別的應用程序的組件名稱,因此,顯式Intent更多用于在應用程序內部傳遞消息比如在某應用程序內,一個 Activity 啟動一個S

7、ervice 。11 什么是 Dalvik Virtual Machine ?(Dalvik虛擬機器)是一種暫存器型態(tài)的虛擬機器。簡稱 DVM , DVM在撰寫開發(fā)時就已 經設想用最少的記憶體資源來執(zhí)行,以及同時可執(zhí)行多個VM為前提來開發(fā)的。大部分安卓應用程序都是用Java編寫的,然后被編譯成字節(jié)碼,字節(jié)碼通過dilvik虛擬機在運行環(huán)境中被解釋執(zhí)行12安卓日志類Log有幾種常用方法?各用于什么輸出什么信息?哪些信息只應該在開發(fā)的時候才允許輸出?Errors應用程序拋出的異常WarningsInformational messagesDebug messagesVerbose messages

8、在開發(fā)人員調試應用程序是輸出13 什么是 Content Provider?內容提供器 是應用程序之間共享數據的接口A content provider can store and retrive data making it accessible to all application比如:聯系人提供器專為不同應用程序提供聯系人數據;設置提供器專為不同應用程序提供系統(tǒng)配置信息,包括內置的設置應用程序等。14 什么是 Broadcast Receiver?廣播接收器是一個專注于接收廣播通知信息,并做出對應處理的組件。應用程序可以擁有任意數量的廣播接收器以對所有它感興趣的通知信息予以響應。所有的接

9、收器均繼承自BroadcastReceiver 基類。廣播接收器沒有用戶界面。然而,它們可以啟動一個activity來響應它們收到的信息,或者用NotificationManager來通知用戶。通知可以用很多種方式來吸引用戶的注意力閃動背燈、震動、播放聲音等等。一般來說是在狀態(tài)欄上放一個持久的圖標,用戶可以打開 它并獲取消息。15什么是Intent?Intent (意圖)主要是 解決Android應用的各項組件之間的通訊。Intent負責對應用中一次操作的動作、動作涉及數據、附加數據進行描述,Android則根據此Intent的描述,負責找到對應的組件,將 Intent傳遞給調用的組件,并完成

10、組件的調用。16什么是Service , Service 有哪些狀態(tài)?Services是一個沒有任何 UI能夠在后臺長時間運行的應用程序組件Service 是 android 系統(tǒng)中的 四大組件之一 (Activity 、Service、BroadcastReceiver 、 ContentProvider ),它跟Activity 的級別差不多, 但不能自己運行只能后臺運行, 并且可 以和其他組件進行交互。Started 一個 activity 調用 startService()來啟動它Bound 一個 activity 調用 bindService() 來綁定它17安卓的資源有哪些類型?各

11、放在什么位置?Bool 用XML格式定義的布爾值文件位置:res/values/filename.xmlColor用XML格式定義的顏色值文件位置:res/values/colors.xmlDimens用XML格式定義的數量值文件位置:res/values/filename.xmlID用XML格式定義的紫苑唯一ID文件位置:res/values/filename.xmlInteger用XML格式定義的整數資源文件位置:res/values/filename.xmlInteger Array 用XML格式定義的整數數組文件位置:res/values/filename.xmlTyped Array

12、 用 XML 格式定義的 TypedArray 文件位置:res/values/filename.xml18 IPC是什么意思?和Intent有什么關系?Inter-Process CommunicationIPC是內部進程通信的簡稱,是共享"命名管道"的資源。Android中的IPC機制是為了讓Activity和Service之間可以隨時的進行交互,故在 Android中該機制,只適用于Activity和Service之間的通信,類似于遠程方法調用,類似于C/S模式的訪問。通過定義 AIDL接口文件來定義IPC接口。Servier端實現IPC接口,Client端調用IPC

13、接口本地代理19 Broadcast 有哪幾種?區(qū)別? (8.14)Normal broadcastsBroadcasts sent to all interested receivers at the same time and the receivers run in an udefined order oftenat the same timeOrdered broadcastsBroadcasts are sent ti all the interested receivers in a peoper order,which means that a broadcasts is del

14、ivered to one receivers at a time20 Ordered broadcast 如何 決定接收者的順序? Ordered broadcast how to decide the order?To control the order in which all the interested receivers run ,you can use the android:priority attribute of the receiver intent-fi 1tes element. However ,receivers with the same priority wi

15、ll be run in an arbitrary order(無序)21安卓中的Permissions ,包括怎么向系統(tǒng)申請權限,怎么用權限保護自己等(14.9-14.11 )在 Manifest.xml文件中聲明一個permission ></permission>然后在activity ></activity>( 或者 其他)中 力口入 android : permission= " permissionname ”屬性這樣以后其他應用程序使用這個程序需要先申請對應權限22安卓原生支持幾種 IO機制?各自有什么特點?Android nativ

16、e support for severalIO mechanisms? The respective characteristics of what?23安卓原生的 content provider有哪些?Browser用于訪問與瀏覽歷史,書簽,搜索記錄相關的數據Contacts 用于訪問和修改 native contact details databaseCall log用于訪問通話記錄Media store 訪問設備上的多媒體文件( multimedia file )Settings 用于訪問和修改設備的參數設置,藍牙,鈴聲24 如何創(chuàng)建一個 content provider ?打開EOE

17、工程,創(chuàng)建一個新的 Eoe類,擴展Content Provider o重寫onCreate、getType、 query、insert> delete 和 update 方法。25安卓下訪問一個文件,要寫到文件最后,要用什么模式打開文件?To access a file to be written to a file for Android, finally, to open the file with whatpattern?MODE_APPEND如果不存在就創(chuàng)建MODE_PRIVATE創(chuàng)建的文件只只讓本程序訪問MODE_WORLD_READABLEMODE_WORLD_WRITEAB

18、LE26 判斷 SD 卡是否可用,用什么方法?Judging the SD card is available, with whatmethod?Android.os.Environment 類String state = Environment.getExternalStorageState() / 獲取 SD卡的狀態(tài)MEDIA_MOUNTED示SD卡存在并且掛載,可以讀或者寫MEDIA_REMOVED示 沒有檢測至U SD卡MEDIA_UNMOUNTED SD卡存在但是沒有掛載MEDIA_MOUNTED_READ_ONLY SD卡存在且掛載,但是只讀27 Shared Preference

19、s是什么?有什么用?SharedPreferences是Android平臺上一個輕量級的存儲類,主要是保存一些常用的配置比如 窗口狀態(tài),一般在 Activity 中 重載窗口狀態(tài)onSaveInstanceState保存一般使用 SharedPreferences完成,它提供了 Android平臺常規(guī)的Long長整形、Int整形、String字符串 型的保存28要從遠端UR陰放多媒體文件用什么stream ?HTTP streaming29創(chuàng)建一個安卓數據庫都有哪些途徑?Create an Android databases have what way?2種通過 Shell Commands:

20、打開adb shell ,使用cd命令轉到需要創(chuàng)建數據庫的文件夾下,使用 sqlite3<database name>直接創(chuàng)建一個數據庫通過代碼創(chuàng)建:使用 android.database.sqlite.SQLiteDatabase 類 SQLiteDatabase sqlDB;SqlDB = openOrCreateDatabase(NAME,SQLiteDatabase.CREATE_IF_NECESSAULL); SqlDB.execSQL( " CRETAHLE' + TABLE_NAME+ “ idINTEGERPRIMARY KEYName TEXT,

21、 Phone LONG”)30安卓有幾種布局管理器(Layout ) ?各有什么特點?Android has several layout manager(Layout)? What are the characteristics? 5種I.FrameLayout children按照從左上開始的順序排列, 主要用于tabed view或者圖片切換功 能;最簡單的布局模型, 在這種布局下每個添加的子控件都被放在布局的左上角,并覆蓋在前一子控件的上層。2 .線性布局(LinearLayout ) :children排列成一行多列或者一列多行的形式,應該是應用程 序中最常用的布局方式,它提供了控件

22、水平或者垂直排列的模型,同時我們可通過設置子控件的weight布局參數控制各個控件在布局中的相對大小。3 .相對布局(RelativeLayout ) children是相互之間相關位置或者和他們的parent位置相關,參照控件可以是父控件,也可以是其他子控件,但被參照的控件必須要在參照它的控件之前定義。相對布局模型所涉及的屬性設置比較多,但并不復雜。4 .TableLayout children按照行列的排序,類似于 html的table ;模型以行列的形式管理子 控件,每一行為一個 TableRow 的對象,也可為一個 View的對象。TableRow 可添加子控 件,每添加一個子控件為一

23、列。5 .坐標布局(AbsoluteLayout )的子控件需要指定相對于此坐標布局的橫、縱坐標值,否則 將會像FrameLayout那樣被排在左上角。手機應用需要適用于不同的屏幕大小,而這種布 局模型不能自適應屏幕尺寸大小,所以應用得相當少。31按下button ,被調用的回調函數是什么? (4.8 )Press button, is what is the callback function is called?onTouchEvent()32 安卓內建的 theme 有哪些? What are the Android built in theme?Theme.Black:Theme.Li

24、ght:Theme.Translucent:Theme.Dialog:Theme.Holo:33各種對話框共同的父類是是什么?Various dialog common parent class is what?Dialog34 View 類是什么?起什么作用? What is View? What is the role?View作為UI的最基本的元件,負責繪制UI元素和界面動作的監(jiān)聽。可以認為是 Button ,文本域等界面元素或者其他View的容器。29 Options Menu 是什么? Context Menu 是什么?Android手機上有個 Menu按鍵,當Menu按下的時候,每

25、個Activity都可以選擇處理這一請 求,在屏幕底部彈出一個菜單,這個菜單我們就叫做選項菜單(OptionsMenu)Android 的上下文菜單(Context Menu) 30 Android 原生支持哪幾種 Dialog ? What kinds of native Android support Dialog?(10.17) AlertDialog 提示性 ProgressDialog 進度條 DatePickerDialog允許用戶選擇一個日期TimePickerDialog允許用戶選擇一個時間31安卓畫圖相關的主要有哪3個類?各自作用?Android drawing relate

26、d what are the 3 main classes? Their role?1) Color:顏色對象,相當于現實生活中的調料2) Paint :畫筆對象,相當于現實生活中畫圖用的筆主要的還是對畫筆進行設置3) Canvas:畫布對象,相當于現實生活中畫圖用的紙 或 布三者相結合,就能畫出基本的圖形32復合控件(compound views )是什么?復合控件是原子的、可重復使用的widget,它包含多個子控件,以某種布局方式聯系在一起。33 ADB是什么? ADB工具一般存放在什么位置?What is ADB? ADB tools are generally stored in wh

27、at position?adb是androidsdk里的一個工具,用這個工具可以直接操作管理android模擬器或者真實的andriod設備(如G1手機).它的主要功能有:* 運行設備的shell (命令行)* 管理模擬器或設備的端口映射* 計算機和設備之間上傳/下載文件* 將本地apk軟件安裝至模擬器或android設備 當前用戶的工作目錄34 安卓開發(fā)環(huán)境包括哪些東西?Android development environment includes what?Device emulator 設備模擬器Debugging tools 調試工具Memory and performance pr

28、ofiler內存及性能分析工具Eclipse集成開發(fā)環(huán)境以及安卓開發(fā)插件35安卓應用程序有哪些類型?What type of Android applications?前臺應用程序后臺應用程序間歇式應用程序小組件36 <uses-permission> 和 <uses-feature>是什么? 各自干什么用的?使用權限 用來保護用戶資源的安全利用特征Android Market會根據uses-feature過濾所有你設備不支持的應用。37 周期性 Alarm 用什么方法創(chuàng)建?The periodic Alarm with what method to create?se

29、tRepeating()38安卓如何獲得位置提供者,具體方法類有哪些?安卓支持哪幾種Location Provider ?GPSCell tower triangulationWi-Fi hosspotsLocationManagerAndroid how to obtain location provider, what are the specific methods?39安卓收到一個短信,會觸發(fā)什么樣的broadcast ?SMS_RECEIVED40 什么是 ADT-Plugin ?ADT (Android開發(fā)工具包) 是一個為Eclipse集成開發(fā)環(huán)境設計的有效、快速構建 Andro

30、id應用程序的插件。ADT擴展了 Eclipse的功能,讓您快速建立新的Android項目,創(chuàng)建一個應用程序UI ,添加基于Android框架API的程序包,使用SDK工具調試你的程序,甚至導出簽名的(或未簽名的)apk格式的文件來發(fā)布你的應用程序。發(fā)送短信,撥叫某個號碼(可以是直接撥叫、也可以是啟動撥號面板,不考慮權限問題) 直接呼叫 Intent i = new Intent(Intent.ACTION_CALL, Uri.parse("tel:")撥號面板 dialIntent = new Intent( Intent.ACTION_DIAL,Uri.parse( &

31、quot;tel:)") 發(fā)送短信:private EditText phone_number_editTextprivate EditText sms_content_editText;private Button send_sms_button;phone_number_editText = (EditText) findViewById(R.id.phone_number_editText);sms_content_editText = (EditText) findViewById(R.id.sms_content_editText);send_sms_button = (B

32、utton) findViewById(R.id.send_sms_button);send_sms_button.setOnClickListener(new View.OnClickListener() Overridepublic void onClick(View arg0) String phone_number = phone_number_editText.getText().toString().trim();String sms_content = sms_content_editText.getText().toString().trim();if(phone_number

33、.equals("") Toast.makeText(MainActivity.this,請輸入手機號碼”, Toast.LENGTH_LONG).show(); else SmsManager smsManager = SmsManager.getDefault();if(sms_content.length() > 70) / 當短信超過SMS消息的最大長度時,將短信分割為幾塊。List<String> contents = smsManager.divideMessage(sms_content);for(String sms : contents)

34、 smsManager.sendTextMessage(phone_number, null, sms, null, null); else smsManager.sendTextMessage(phone_number, null, sms_content, null, null);Toast.makeText(MainActivity.this,發(fā)送成功 ”,Toast.LENGTH_SHORT).show(););如何從內部、外部(SD卡)存儲器存取文件內部:Strint Filename ="mydata.txt ”;Strint data =" hello wor

35、ld ”;寫newtryPrintWriterpw=PrintWriter(openFileOutput(FILENAME,Context.MODE_PRIVATE);pw.println( “ hello world ” ); pw.close();Catch(Exception ex)Log.e( “ Exception ” , ex.toStrin)g; ()/讀 tryBufferedInputStream bis =new BufferedInputStream( openFileInput(FILENAME); byte buffer = new byte10000;while(

36、bis.read(buffer) != -1) String mydata = new String (buffer);Bis.close();Catch(Exception ex) Log .e( “ Exception ” , ex.toString() )SD 卡: 使用之前需要查詢是否可用Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)=1寫String MYFILE =“ MyData.txt ”;tryPrintWriter pw = new PrintWriter(new FileOut

37、putStream ( Environment.getExternalStorageDirect or() +” / ” + MYF)I;LE )pw.write( “ hello world ”) pw.close();catch(Exceprtion ex)Log.e( “ io ” , ” error ”)讀tryBufferedInputStream bis = new BufferedInputStream(newFileInputStream(Environment.getExternalStorageDiretor()+” / ” +MYFILE);Byte buffer = n

38、ew bytefis.available(); bis.read(buffer);string str = new string(buffer); bis.close();catch(Exception ex)Log.e( “io”error);如何獲取當前地理位置. How the current geographical location access獲取LocationManager 的一個實例LocationManagerlocationManager=(LocationManager)getSystemService(Context.LOCATION_SERVICE);注冊一個周期性

39、的位置更新locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, locationListener);最后一個參數是LocationListener的一個引用,我們必須要實現這個類private final LocationListener locationListener = new LocationListener() public void onLocationChanged(Location location) 當坐標改變時觸發(fā)此函數,如果Provider傳進相同的坐標,它就不會被觸發(fā)/

40、 log it when the location changes if (location != null) Log.i("SuperMap", "Location changed : Lat:"+ location.getLatitude() + " Lng:"+ location.getLongitude(); public void onProviderDisabled(String provider) / Provider被disable時觸發(fā)此函數,比如 GPS被關閉 public void onProviderEnabl

41、ed(String provider) / Provider被enable時觸發(fā)此函數,比如 GPS被打開 public void onStatusChanged(String provider, int status, Bundle extras) / Provider的轉態(tài)在可用、暫時不可用和無服務三個狀態(tài)直接切換時觸發(fā)此函數 ;以上的這些步驟一般應當在 Activity的onCreate()階段完成。在成功注冊了一個周期性坐標 更新以后,我們就隨時可以通過下面的方法來取得當前的坐標了。LocationlocationlocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);double latitude = location.getLatitude();經度double longitude = location.getLongitude()

溫馨提示

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

最新文檔

評論

0/150

提交評論