intent action

1 Intent.ACTION_MAIN

String: android.intent.action.MAIN

標識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:電話號碼。數據格式爲: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

調用撥號面板

Intent intent=new Intent();
intent.setAction(Intent.ACTION_DIAL); //android.intent.action.DIAL
intent.setData(Uri.parse("tel:1320010001");
startActivity(intent);

Input:電話號碼。數據格式爲:tel:+phone number

Output:Nothing

說明:打開Android的撥號UI。如果沒有設置數據,則打開一個空的UI,如果設置數據,action.DIAL則通過調用getData()獲取電話號碼。

但設置電話號碼的數據格式爲 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

別用於指定一些數據應該附屬於一些其他的地方,例如,圖片數據應該附屬於聯繫人

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.

相當於用戶按下“撥號”鍵。經測試顯示的是“通話記錄”

Input:nothing

Output:nothing

Intent intent = new Intent(Intent.ACTION_CALL_BUTTON);
startActivity(intent);

 

 

9 Intent.ACTION_CHOOSER

String: android.intent.action.CHOOSER

顯示一個activity選擇器,允許用戶在進程之前選擇他們想要的,與之對應的是Intent.ACTION_GET_CONTENT.

 

10. Intent.ACTION_GET_CONTENT

String: android.intent.action.GET_CONTENT

允許用戶選擇特殊種類的數據,並返回(特殊種類的數據:照一張相片或錄一段音)

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方法來獲取選擇的數據內容。

 

http://www.cnblogs.com/wservices/archive/2010/07/07/1772737.html 出處

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章