Intent.ACTION_MAIN
1 Intent.ACTION_MAIN
String: android.intent.action.MAIN
標(biāo)識Activity為一個程序的開始。比較常用。
Input:nothing
Output:nothing
例如:
1?<activity?android:name=".Main"?android:label="@string/app_name">2?????<intent-filter>
3?????????<action?android:name="android.intent.action.MAIN"?/>
4?????????<category?android:name="android.intent.category.LAUNCHER"?/>
5?????</intent-filter>
6?</activity>
??
2?Intent.Action_CALL
Stirng: android.intent.action.CALL
呼叫指定的電話號碼。
Input:電話號碼。數(shù)據(jù)格式為:tel:+phone number?
Output:Nothing
Intent?intent=new?Intent();intent.setAction(Intent.ACTION_CALL);???
intent.setData(Uri.parse("tel:1320010001");
startActivity(intent);
??
3 Intent.Action.DIAL
String: action.intent.action.DIAL
調(diào)用撥號面板
Intent?intent=new?Intent();intent.setAction(Intent.ACTION_DIAL);???//android.intent.action.DIAL
intent.setData(Uri.parse("tel:1320010001");
startActivity(intent);
Input:電話號碼。數(shù)據(jù)格式為:tel:+phone number?
Output:Nothing
說明:打開Android的撥號UI。如果沒有設(shè)置數(shù)據(jù),則打開一個空的UI,如果設(shè)置數(shù)據(jù),action.DIAL則通過調(diào)用getData()獲取電話號碼。
但設(shè)置電話號碼的數(shù)據(jù)格式為 tel:+phone number.
?
4.Intent.Action.ALL_APPS
String: andriod.intent.action.ALL_APPS
列出所有的應(yīng)用。
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
別用于指定一些數(shù)據(jù)應(yīng)該附屬于一些其他的地方,例如,圖片數(shù)據(jù)應(yīng)該附屬于聯(lián)系人
Input: Data
Output:nothing
?
7 Intent.ACTION_BUG_REPORT
String: android.intent.action.BUG_REPORT
顯示Dug報告。
Input:nothing
output:nothing
?
8 Intent.Action_CALL_BUTTON
String: android.action.intent.CALL_BUTTON.
相當(dāng)于用戶按下“撥號”鍵。經(jīng)測試顯示的是“通話記錄”
Input:nothing
Output:nothing
Intent?intent?=?new?Intent(Intent.ACTION_CALL_BUTTON);startActivity(intent);
?
?
9 Intent.ACTION_CHOOSER
String: android.intent.action.CHOOSER
?顯示一個activity選擇器,允許用戶在進程之前選擇他們想要的,與之對應(yīng)的是Intent.ACTION_GET_CONTENT.
?
10. Intent.ACTION_GET_CONTENT
String: android.intent.action.GET_CONTENT
允許用戶選擇特殊種類的數(shù)據(jù),并返回(特殊種類的數(shù)據(jù):照一張相片或錄一段音)
Input: Type
Output:URI
這個以前用到過,看事例。
選擇一個圖片:
代碼 int?requestCode?=?1001;Intent?intent?=?new?Intent(Intent.ACTION_GET_CONTENT);?//?"android.intent.action.GET_CONTENT"
intent.setType("image/*");?//?查看類型,如果是其他類型,比如視頻則替換成 video/*,或 */*
Intent?wrapperIntent?=?Intent.createChooser(intent,?null);
startActivityForResult(wrapperIntent,?requestCode);
?
可通過重寫onActivityResult方法來獲取選擇的數(shù)據(jù)內(nèi)容。
總結(jié)
以上是生活随笔為你收集整理的Intent.ACTION_MAIN的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android类库介绍
- 下一篇: 同步阻塞的BIO、同步非阻塞的NIO、异