日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人工智能 > ChatGpt >内容正文

ChatGpt

Intent.ACTION_MAIN

發布時間:2023/11/30 ChatGpt 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Intent.ACTION_MAIN 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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

總結

以上是生活随笔為你收集整理的Intent.ACTION_MAIN的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。