本文介紹Android中Intent的各種常見(jiàn)作用。
1 Intent.ACTION_MAIN
String: android.intent.action.MAIN
標(biāo)識(shí)Activity為1個(gè)程序的開(kāi)始。比較經(jīng)常使用。
Input:nothing
Output:nothing
2 Intent.Action_CALL
Stirng: android.intent.action.CALL
呼喚指定的電話號(hào)碼。
Input:電話號(hào)碼。數(shù)據(jù)格式為:tel:+phone number
Output:Nothing
intent.setAction(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:1320010001");
startActivity(intent);
3 Intent.Action.DIAL
String: action.intent.action.DIAL
調(diào)用撥號(hào)面板
Input:電話號(hào)碼。數(shù)據(jù)格式為:tel:+phone number
Output:Nothing
說(shuō)明:打開(kāi)Android的撥號(hào)UI。如果沒(méi)有設(shè)置數(shù)據(jù),則打開(kāi)1個(gè)空的UI,如果設(shè)置數(shù)據(jù),action.DIAL則通過(guò)調(diào)用getData()獲得電話號(hào)碼。
但設(shè)置電話號(hào)碼的數(shù)據(jù)格式為 tel:+phone number.
4 Intent.Action.ALL_APPS
String: andriod.intent.action.ALL_APPS
列出所有的利用。
Input:Nothing.
Output:Nothing.
5 Intent.ACTION_ANSWER
Stirng:android.intent.action.ANSWER
處理呼入的電話。
Input:Nothing.
Output:Nothing.
6 Intent.ACTION_ATTACH_DATA
String: android.action.ATTCH_DATA
別用于指定1些數(shù)據(jù)應(yīng)當(dāng)附屬于1些其他的地方,例如,圖片數(shù)據(jù)應(yīng)當(dāng)附屬于聯(lián)系人
Input: Data
Output:nothing
7 Intent.ACTION_BUG_REPORT
String: android.intent.action.BUG_REPORT
顯示Dug報(bào)告。
Input:nothing
output:nothing
8 Intent.Action_CALL_BUTTON
String: android.action.intent.CALL_BUTTON.
相當(dāng)于用戶(hù)按下“撥號(hào)”鍵。經(jīng)測(cè)試顯示的是“通話記錄”
Input:nothing
Output:nothing
9 Intent.ACTION_CHOOSER
String: android.intent.action.CHOOSER
顯示1個(gè)activity選擇器,允許用戶(hù)在進(jìn)程之前選擇他們想要的,與之對(duì)應(yīng)的是Intent.ACTION_GET_CONTENT.
10. Intent.ACTION_GET_CONTENT
String: android.intent.action.GET_CONTENT
允許用戶(hù)選擇特殊種類(lèi)的數(shù)據(jù),并返回(特殊種類(lèi)的數(shù)據(jù):照1張相片或錄1段音)
Input: Type
Output:URI
startActivityForResult(wrapperIntent, requestCode);
11 Intent.ACTION_VIEW
String android.intent.action.VIEW
用于顯示用戶(hù)的數(shù)據(jù)。
比較通用,會(huì)根據(jù)用戶(hù)的數(shù)據(jù)類(lèi)型打開(kāi)相應(yīng)的Activity。
比如 tel:13400010001打開(kāi)撥號(hào)程序,http://www.g.cn則會(huì)打開(kāi)閱讀器等。
12 Intent.ACTION_SENDTO
上一篇 Android - Layout clipChildren屬性
下一篇 AngularJS權(quán)威教程 筆記(AngularJS是一個(gè)很有意思的庫(kù),基于函數(shù)形參的依賴(lài)注入?酷!還有奇怪的$scope和指令)