Linux Kernel
Base on Linux 26已修改 kernel 避免 GPL 授權問題
Linux 版權 GNU General Public License version 2 (GPLv2)
Driver 移動 linux userspace硬體廠商不需公開 driver source
Power Management 修改
針對手機環境 沒 關掉
Libraries
Library cc++開發
屬系統元件 開發者透過 Application Framework 來這功
Android Runtime
Core Libraries
對應於 Java Programming Language
Dalvik Virtual Machine (簡稱 DVM)
針對手機開發
Run on Linux Virtual Memory multiple processes
執行指令精簡(節省記憶體)&CPU 效率(not JIT)
Application Framework
Google 提供 API framework 內已經具備種不基礎軟體元件
JAVA
C
C++
ASM Applications
包含內建應程式聯絡eMail Map Calendar 簡訊…等等
從 Market 載程式
行開發程式
Java language 開發
編譯完成 toolaaptexe 包裹為apk
Apk >application
三種基特性
個 application Linux process 中執行
個 process Java VM isolate from other applications
個 application 權限獨立分開 不讀取 application 檔案
Application Framework 應程式常四區塊
四元件
Activities理應程式顯示畫面類別(Activity Life Cycle)
Services服務功(Services Life Cycle)
Broadcast receivers 意圖與廣播接收
Content Provider內容提供
溝通橋樑 Intent
EX 郵件程式中通訊錄清單編輯通訊錄畫面查電子郵件個別 Activity
Intent 開啟個網頁出外個 Activity 電話等等
果 Intent 寫目接收對方傳來訊息還必須產生個 BroadcastReceiver
EX片傳 Intent + BroadcastReceiver當片傳事件發生時 們寫程式會查覺
(Intent + BroadcastReceiver)
Service 需長時間背景值型 EX MP3
Content Provider 開放應程式中資料讓別應程式來檢索EX通訊錄資料
應程式組成:
檢視 Views: Lists girds buttons 等 UI 元素
內容理器 Content Providers:應程式間資料享與資料庫
資源理器 Resource Manager 程式對於非程式資源存取String id picture …
通知理器 Notification Manager 狀態列通知訊息
活動類別理器 Activity Manager 理 Activity 生命周期
Activity:
包括 UI 與 user 互動
面放 buttonlistpicturetext…
UI 動態調整(增加減少換位置)
透過 intent 跳轉 activity
費時程式放 Service handler… 超過 5 秒 會出現 ANR (Android is Not Responding)
Android 台個時刻會個 Activity 處於活動(Active)運行(Running)狀態
Activity 處於未啟動(Dead)停止(Stopped)暫停(Pause)狀態
Active (活動)
「Active」狀態者啟動應程式 Activity 後Activity 運行中狀態
Paused (暫停)
「Paused」狀態當
Activity 暫時暗來退
背景畫面狀態
當們 Toast
AlertDialog電話來
時會讓原運行
Activity 退背景畫面新
出現 ToastAlertDialog
等介面元件蓋住原來
Activity 畫面Activity 處
「Paused」狀態時
者無法與原 Activity 互
動
Stopped (停止)
「Stopped」狀態
Activity 正執行這個
Activity 已經離開螢幕
動作狀態
透過長「Home」鈕
出處於「Stopped」
狀態應程式列表
「Stopped」狀態
Activity還透過
「Notification」來喚醒
Dead (已回收未啟動)
「Dead」狀態 Activity 尚未啟動已經手動終止已經系統回收狀態
手動終止 Activity程式中呼「finish」函式
果系統回收為記憶體足系統根據記憶體足時回收規則將處
於「Stopped」狀態 Activity 佔記憶體回收
Intent
來描述個程式想作什麼事情
個 Intent 帶個動作(action)並根據不動作行動
Service
長時間於背景執行 無 UI 畫面
避免 ANR 問題
例:播放音樂背景接收網路訊息壓縮 or 解壓縮檔案
利 bindService() 讓 Activity 與 Service 溝通
Broadcast Receiver
監聽興趣 Intent
利 sendBroadcast()啟動個廣播 並附對應參數
於 5sec內完成
啟動特定 Activity or Service or 更新畫面
例:Android 系統於電力狀況變動時 傳遞個電力廣播們個電力容量理
程式 則接收廣播 並顯示於畫面提供鈴聲提示
Content Provider
與程式分享資料
例:contentcontactspeople45 (傳回聯絡編號 45 相關資料)
ANDROID …
1應程式律等 (Applications)
httpwwwyoutubecomwatchv3aUjukCdPyQ
2應程式無界限 (Intent filter)
httpwwwyoutubecomwatchv3LkNlTNHZzE
3應程式輕鬆嵌入網頁 (webView)
httpwwwyoutubecomwatchvEx7YsQ_YH2U
4應程式行執行 (service 機制)
httpwwwyoutubecomwatchv7lScgyXGxwo
public void onClick()
{
Uri uri Uriparse(httpwwwpccucomtw)
Intent intent new Intent(IntentACTION_VIEW uri)
startActivity(intent)
}
《香当网》用户分享的内容,不代表《香当网》观点或立场,请自行判断内容的真实性和可靠性!
该内容是文档的文本内容,更好的格式请下载文档