當前位置:首頁 » 安卓系統 » androidintent大全

androidintent大全

發布時間: 2023-01-31 12:46:07

『壹』 android 怎麼intent

Intent intent = new Intent(this,目標Activity.class);
startActivity(intent);
這個就是示例

『貳』 android的intent

IntentFilter是對於符合條件的activity進行過濾, 要想進行動作攔截建議使用BroadcastReceiver ,根據action部分確定攔截,。。 攔截Android手機發出的簡訊好像只能監聽到發送中和發送完畢的動作,要想攔截系統發出簡訊並加上自己的標識好像不修改底端是做不到的

『叄』 Android開發之Intent.Action Android中Intent的各種常見作用【轉】

1 Intent.ACTION_MAIN

String: Android.intent.action.MAIN標識Activity為一個程序的開始。比較常用。Input:nothingOutput:nothing

2 Intent.Action_CALL

【直接呼叫,在6.0之後的版本需要獲取許可權,詳見 Android開發學習之路-Android6.0運行時許可權【轉】 】

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.

5Intent.ACTION_ANSWER

Stirng:android.intent.action.ANSWER處理呼入的電話。Input:Nothing.Output:Nothing.

6 Intent.ACTION_ATTACH_DATA

String: android.action.ATTCH_DATA別用於指定一些數據應該附屬於一些其他的地方,例如,圖片數據應該附屬於聯系人Input: DataOutput:nothing

7 Intent.ACTION_BUG_REPORT

String: android.intent.action.BUG_REPORT顯示Dug報告。Input:nothingoutput:nothing

8 Intent.Action_CALL_BUTTON

String: android.action.intent.CALL_BUTTON.相當於用戶按下「撥號」鍵。經測試顯示的是「通話記錄」Input:nothingOutput: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: TypeOutput: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);

11 Intent.ACTION_VIEW

String:android.intent.action.VIEW用於顯示用戶的數據。比較通用,會根據用戶的數據類型打開相應的Activity。比如 tel:13400010001打開撥號程序,http://www.g.cn則會打開瀏覽器等。

Uri uri = Uri.parse("http://www.google.com"); //瀏覽器 Uri uri =Uri.parse("tel:1232333"); //撥號程序

Uri uri=Uri.parse("geo:39.899533,116.036476"); //打開地圖定位

Intent it = new Intent(Intent.ACTION_VIEW,uri);

startActivity(it);

//播放視頻

Intent intent = new Intent(Intent.ACTION_VIEW);

Uri uri = Uri.parse("file:///sdcard/media.mp4");

intent.setDataAndType(uri, "video/*");

startActivity(intent);

//調用發送簡訊的程序

Intent it = new Intent(Intent.ACTION_VIEW);

it.putExtra("sms_body", "信息內容...");

it.setType("vnd.android-dirs-sms");

startActivity(it);

12 Intent.ACTION_SENDTO

String: android.intent.action.SENDTO

說明:發送簡訊息

//發送簡訊息 Uri uri = Uri.parse("smsto:13200100001");

Intent it = new Intent(Intent.ACTION_SENDTO, uri);

it.putExtra("sms_body", "信息內容...");

startActivity(it);

//發送彩信,設備會提示選擇合適的程序發送 Uri uri = Uri.parse("content://media/external/images/media/23");

//設備中的資源(圖像或其他資源)

Intent intent = new Intent(Intent.ACTION_SEND);

intent.putExtra("sms_body", "內容");

intent.putExtra(Intent.EXTRA_STREAM, uri);

intent.setType("image/png");

startActivity(it);

//Email Intent intent=new Intent(Intent.ACTION_SEND);

String[] tos={"[email protected]"};

String[] ccs={"[email protected]"};

intent.putExtra(Intent.EXTRA_EMAIL, tos);

intent.putExtra(Intent.EXTRA_CC, ccs);

intent.putExtra(Intent.EXTRA_TEXT, "The email body text");

intent.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");

intent.setType("message/rfc822");

startActivity(Intent.createChooser(intent, "Choose Email Client"));

13 Intent.ACTION_GET_CONTENT

//選擇圖片 requestCode 返回的標識

Intent intent = new Intent(Intent.ACTION_GET_CONTENT); //"android.intent.action.GET_CONTENT"

intent.setType(contentType); //查看類型 String IMAGE_UNSPECIFIED = "image/*";

Intent wrapperIntent = Intent.createChooser(intent, null);

((Activity) context).startActivityForResult(wrapperIntent, requestCode);

//添加音頻

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);

intent.setType(contentType); //String VIDEO_UNSPECIFIED = "video/*";

Intent wrapperIntent = Intent.createChooser(intent, null);

((Activity) context).startActivityForResult(wrapperIntent, requestCode);

//拍攝視頻

int rationLimit = getVideoCaptureDurationLimit(); //SystemProperties.getInt("ro.media.enc.lprof.ration", 60);

Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);

intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, sizeLimit);

intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, rationLimit);

startActivityForResult(intent, REQUEST_CODE_TAKE_VIDEO);

//視頻

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);

intent.setType(contentType); //String VIDEO_UNSPECIFIED = "video/*";

Intent wrapperIntent = Intent.createChooser(intent, null);

((Activity) context).startActivityForResult(wrapperIntent, requestCode);

//錄音

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);

intent.setType(ContentType.AUDIO_AMR); //String AUDIO_AMR = "audior";

intent.setClassName("com.android.soundrecorder",

"com.android.soundrecorder.SoundRecorder");

((Activity) context).startActivityForResult(intent, requestCode);

//拍照 REQUEST_CODE_TAKE_PICTURE 為返回的標識

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); //"android.media.action.IMAGE_CAPTURE";

intent.putExtra(MediaStore.EXTRA_OUTPUT, Mms.ScrapSpace.CONTENT_URI); // output,Uri.parse("content:/s/scrapSpace");

startActivityForResult(intent, REQUEST_CODE_TAKE_PICTURE);

『肆』 android中intent的作用 越詳細越好

1 Intent.ACTION_MAIN

String: android.intent.action.MAIN

標識Activity為一個程序的開始。比較常用。

Input:nothing

Output:nothing

例如:

1
2
3
4
5
6

也可以直接在程序中實現 Intent it = new Intent(原Activity.class,需跳轉Activity.class);
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);

『伍』 大學期末復習 android 中 intent組件的屬性有哪些

Intent主要有以下四個重要屬性,它們分別為:
Action:Action屬性的值為一個字元串,它代表了系統中已經定義了一系列常用的動作。通過setAction()方法或在清單文件AndroidManifest.xml中設置。默認為:DEFAULT。
Data:Data通常是URI格式定義的操作數據。例如:tel:// 。通過setData()方法設置。
Category:Category屬性用於指定當前動作(Action)被執行的環境。通過addCategory()方法或在清單文件AndroidManifest.xml中設置。默認為:CATEGORY_DEFAULT。
Extras:Extras屬性主要用於傳遞目標組件所需要的額外的數據。通過putExtras()方法設置。
四個屬性各自的常用值如下所示:
Action:
ACTION_MAIN:Android Application的入口,每個Android應用必須且只能包含一個此類型的Action聲明。
ACTION_VIEW:系統根據不同的Data類型,通過已注冊的對應Application顯示數據。
ACTI ON_EDIT:系統根據不同的Data類型,通過已注冊的對應Application編輯示數據。
ACTION_DIAL:打開系統默認的撥號程序,如果Data中設置了電話號碼,則自動在撥號程序中輸入此號碼。
ACTION_CALL:直接呼叫Data中所帶的號碼。
ACTION_ANSWER:接聽來電。
ACTION_SEND:由用戶指定發送方式進行數據發送操作。
ACTION_SENDTO:系統根據不同的Data類型,通過已注冊的對應Application進行數據發送操作。
ACTION_BOOT_COMPLETED:Android系統在啟動完畢後發出帶有此Action的廣播(Broadcast)。
ACTION_TIME_CHANGED:Android系統的時間發生改變後發出帶有此Action的廣播(Broadcast)。
ACTION_PACKAGE_ADDED:Android系統安裝了新的Application之後發出帶有此Action的廣播(Broadcast)。
ACTION_PACKAGE_CHANGED:Android系統中已存在的Application發生改變之後(如應用更新操作)發出帶有此Action的廣播(Broadcast)。
ACTION_PACKAGE_REMOVED:卸載了Android系統已存在的Application之後發出帶有此Action的廣播(Broadcast)。
Category:
CATEGORY_DEFAULT:Android系統中默認的執行方式,按照普通Activity的執行方式執行。
CATEGORY_HOME:設置該組件為Home Activity。
CATEGORY_PREFERENCE:設置該組件為Preference。
CATEGORY_LAUNCHER:設置該組件為在當前應用程序啟動器中優先順序最高的Activity,通常為入口ACTION_MAIN配合使用。
CATEGORY_BROWSABLE:設置該組件可以使用瀏覽器啟動。
CATEGORY_GADGET:設置該組件可以內嵌到另外的Activity中。
Extras:
EXTRA_BCC:存放郵件密送人地址的字元串數組。
EXTRA_CC:存放郵件抄送人地址的字元串數組。
EXTRA_EMAIL:存放郵件地址的字元串數組。
EXTRA_SUBJECT:存放郵件主題字元串。
EXTRA_TEXT:存放郵件內容。
EXTRA_KEY_EVENT:以KeyEvent對象方式存放觸發Intent的按鍵。
EXTRA_PHONE_NUMBER:存放調用ACTION_CALL時的電話號碼。
Data:
tel://:號碼數據格式,後跟電話號碼。
mailto://:郵件數據格式,後跟郵件收件人地址。
smsto://:短息數據格式,後跟簡訊接收號碼。
content://:內容數據格式,後跟需要讀取的內容。
file://:文件數據格式,後跟文件路徑。
market://search?q=pname:pkgname:市場數據格式,在Google Market里搜索包名為pkgname的應用。
geo://latitude, longitude:經緯數據格式,在地圖上顯示經緯度所指定的位置。

『陸』 android中Intent問題

Android 開發網站上解釋了一下,如果你想允許其它的app通過 intent-filter 命中你的 app 啟動它,我們需要給我們的 app 添加 default category,一般來說沒有 default category 是表示這個 activity 肯定只是我們 app 自己使用,比如我們一個app有多個 activity,只有主控 activity 會訪問其它的 activity 時就是這樣的。因為隱含地啟動一個 app 的方式是通過對比 intent 條件的,我們沒有指定 default category 就是表示我們不打算被其它程序隱含地啟動(比如我們想放個木馬什麼的)。

這個文檔說明了,想以隱含方式啟動 activity 就需要添加 default category,這是因為需要允許其它app來啟動你的activity (而啟動自己的activity甚至可以直接使用類名來,不需要這么麻煩)。

另外,當我們希望把主控activity列在應用程序列表中時我們就給它添加 launcher category。

舉個例子,一個產品管理程序,主控activity是先打開當前熱銷產品列表,它在手機的應用程序列表中,因此需要一個 launcher category,它有一個產品詳細介紹的activity可以允許通過一個產品編號來查看產品,甚至在網頁上有個鏈接,這時這個產品詳細介紹activity就需要一個default category但不需要launcher category,而另一個修改產品資料的activity則不是必須添加一個category,因為它只會被主控activity啟動並且外部其它app不應該有機會隱含地啟動它。

http://developer.android.com/guide/components/intents-filters.html

『柒』 怎麼獲取android系統服務,如Uri,intent參數等,或者說去哪裡查看

android系統服務,如Uri,intent參數
可以在Intent中指定程序要執行的動作(比如:view,edit,dial),以及程序執行到該動作時所需要的資料。都指定好後,只要調用startActivity(),Android系統會自動尋找最符合你指定要求的應用程序,並執行該程序。

★intent大全:

1.從google搜索內容

Intent intent = new Intent();

intent.setAction(Intent.ACTION_WEB_SEARCH);

intent.putExtra(SearchManager.QUERY,"searchString")

startActivity(intent);

2.瀏覽網頁

Uri uri =Uri.parse("htt。。。。。。。。om");

Intent it = new Intent(Intent.ACTION_VIEW,uri);

startActivity(it);

3.顯示地圖

Uri uri = Uri.parse("geo:38.899533,-77.036476");

Intent it = newIntent(Intent.Action_VIEW,uri);

startActivity(it);

4.路徑規劃

Uri uri =Uri.parse("http。。。。。。。。。。/maps?
f=dsaddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");

Intent it = newIntent(Intent.ACTION_VIEW,URI);

startActivity(it);

5.撥打電話

Uri uri =Uri.parse("tel:xxxxxx");

Intent it = new Intent(Intent.ACTION_DIAL,uri);

startActivity(it);

6.調用發簡訊的程序

Intent it = newIntent(Intent.ACTION_VIEW);

it.putExtra("sms_body", "TheSMS text");

it.setType("vnd.android-dir/mms-sms");

startActivity(it);

7.發送簡訊

Uri uri =Uri.parse("smsto:0800000123");

Intent it = newIntent(Intent.ACTION_SENDTO, uri);

it.putExtra("sms_body", "TheSMS text");

startActivity(it);

String body="this is sms demo";

Intent mmsintent = newIntent(Intent.ACTION_SENDTO, Uri.fromParts("smsto",
number, null));

mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY,body);

mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE,true);

mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT,true);

startActivity(mmsintent);

8.發送彩信

Uri uri =Uri.parse("content://media/external/images/media/23");

Intent it = newIntent(Intent.ACTION_SEND);

it.putExtra("sms_body","some text");

it.putExtra(Intent.EXTRA_STREAM, uri);

it.setType("image/png");

startActivity(it);

StringBuilder sb = new StringBuilder();

sb.append("file://");

sb.append(fd.getAbsoluteFile());

Intent intent = newIntent(Intent.ACTION_SENDTO, Uri.fromParts("mmsto",
number, null));

// Below extra datas are all optional.

intent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_SUBJECT,subject);

intent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY,body);

intent.putExtra(Messaging.KEY_ACTION_SENDTO_CONTENT_URI,sb.toString());

intent.putExtra(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE,composeMode);

intent.putExtra(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT,exitOnSent);

startActivity(intent);

9.發送Email

Uri uri =Uri.parse("mailto:[email protected]");

Intent it = newIntent(Intent.ACTION_SENDTO, uri);

startActivity(it);

Intent it = new Intent(Intent.ACTION_SEND);

it.putExtra(Intent.EXTRA_EMAIL,"[email protected]");

it.putExtra(Intent.EXTRA_TEXT, "Theemail body text");

it.setType("text/plain");

startActivity(Intent.createChooser(it,"Choose Email Client"));

Intent it=new Intent(Intent.ACTION_SEND);

String[] tos={"[email protected]"};

String[]ccs={"[email protected]"};

it.putExtra(Intent.EXTRA_EMAIL, tos);

it.putExtra(Intent.EXTRA_CC, ccs);

it.putExtra(Intent.EXTRA_TEXT, "Theemail body text");

it.putExtra(Intent.EXTRA_SUBJECT, "Theemail subject text");

it.setType("message/rfc822");

startActivity(Intent.createChooser(it,"Choose Email Client"));

Intent it = newIntent(Intent.ACTION_SEND);

it.putExtra(Intent.EXTRA_SUBJECT, "Theemail subject text");

it.putExtra(Intent.EXTRA_STREAM,"file:///sdcard/mysong.mp3");

sendIntent.setType("audio/mp3");

startActivity(Intent.createChooser(it,"Choose Email Client"));

10.播放多媒體

Intent it = new Intent(Intent.ACTION_VIEW);

Uri uri =Uri.parse("file:///sdcard/song.mp3");

it.setDataAndType(uri,"audio/mp3");

startActivity(it);

Uri uri
=Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI,"1");

Intent it = new Intent(Intent.ACTION_VIEW,uri);

startActivity(it);

11.uninstall apk

Uri uri =Uri.fromParts("package", strPackageName, null);

Intent it = newIntent(Intent.ACTION_DELETE, uri);

startActivity(it);

12.install apk

Uri installUri = Uri.fromParts("package","xxx", null);

returnIt = newIntent(Intent.ACTION_PACKAGE_ADDED, installUri);

打開照相機

<1>Intent i = new Intent(Intent.ACTION_CAMERA_BUTTON, null);

this.sendBroadcast(i);

<2>long dateTaken = System.currentTimeMillis();

String name = createName(dateTaken) + ".jpg";

fileName = folder + name;

ContentValues values = new ContentValues();

values.put(Images.Media.TITLE, fileName);

values.put("_data", fileName);

values.put(Images.Media.PICASA_ID, fileName);

values.put(Images.Media.DISPLAY_NAME, fileName);

values.put(Images.Media.DESCRIPTION, fileName);

values.put(Images.ImageColumns.BUCKET_DISPLAY_NAME, fileName);

Uri photoUri = getContentResolver().insert(

MediaStore.Images.Media.EXTERNAL_CONTENT_URI,values);

Intent inttPhoto = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

inttPhoto.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);

startActivityForResult(inttPhoto, 10);

14.從gallery選取圖片

Intent i = new Intent();

i.setType("image/*");

i.setAction(Intent.ACTION_GET_CONTENT);

startActivityForResult(i, 11);

打開錄音機

Intent mi = new Intent(Media.RECORD_SOUND_ACTION);

startActivity(mi);

16.顯示應用詳細列表

Uri uri =Uri.parse("market://details?id=app_id");

Intent it = new Intent(Intent.ACTION_VIEW,uri);

startActivity(it);

//where app_id is the application ID, findthe ID

//by clicking on your application on Markethome

//page, and notice the ID from the addressbar

剛才找app id未果,結果發現用package name也可以

Uri uri =Uri.parse("market://details?id=");

這個簡單多了

17尋找應用

Uri uri =Uri.parse("market://search?q=pname:pkg_name");

Intent it = new Intent(Intent.ACTION_VIEW,uri);

startActivity(it);

//where pkg_name is the full package pathfor an application

18打開聯系人列表

<1>

Intent i = new Intent();

i.setAction(Intent.ACTION_GET_CONTENT);

i.setType("vnd.android.cursor.item/phone");

startActivityForResult(i, REQUEST_TEXT);

<2>

Uri uri = Uri.parse("content://contacts/people");

Intent it = new Intent(Intent.ACTION_PICK, uri);

startActivityForResult(it, REQUEST_TEXT);

19 打開另一程序

Intent i = new Intent();

ComponentName cn = newComponentName("com.yellowbook.android2",

"com.yellowbook.android2.AndroidSearch");

i.setComponent(cn);

i.setAction("android.intent.action.MAIN");

startActivityForResult(i, RESULT_OK);

20.調用系統編輯添加聯系人(高版本SDK有效):

Intent it = newIntent(Intent.ACTION_INSERT_OR_EDIT);

it.setType("vnd.android.cursor.item/contact");

//it.setType(Contacts.CONTENT_ITEM_TYPE);

it.putExtra("name","myName");

it.putExtra(android.provider.Contacts.Intents.Insert.COMPANY,
"organization");

it.putExtra(android.provider.Contacts.Intents.Insert.EMAIL,"email");

it.putExtra(android.provider.Contacts.Intents.Insert.PHONE,"homePhone");

it.putExtra(android.provider.Contacts.Intents.Insert.SECONDARY_PHONE,

"mobilePhone");

it.putExtra( android.provider.Contacts.Intents.Insert.TERTIARY_PHONE,

"workPhone");

it.putExtra(android.provider.Contacts.Intents.Insert.JOB_TITLE,"title");

startActivity(it);

21.調用系統編輯添加聯系人(全有效):

Intent intent = newIntent(Intent.ACTION_INSERT_OR_EDIT);

intent.setType(People.CONTENT_ITEM_TYPE);

intent.putExtra(Contacts.Intents.Insert.NAME, "My Name");

intent.putExtra(Contacts.Intents.Insert.PHONE, "+1234567890");

intent.putExtra(Contacts.Intents.Insert.PHONE_TYPE,Contacts.PhonesColumns.TYPE_MOBILE);

intent.putExtra(Contacts.Intents.Insert.EMAIL, "[email protected]");

intent.putExtra(Contacts.Intents.Insert.EMAIL_TYPE,
Contacts.ContactMethodsColumns.TYPE_WORK);

startActivity(intent);

★intent action大全:

android.intent.action.ALL_APPS

android.intent.action.ANSWER

android.intent.action.ATTACH_DATA

android.intent.action.BUG_REPORT

android.intent.action.CALL

android.intent.action.CALL_BUTTON

android.intent.action.CHOOSER

android.intent.action.CREATE_LIVE_FOLDER

android.intent.action.CREATE_SHORTCUT

android.intent.action.DELETE

android.intent.action.DIAL

android.intent.action.EDIT

android.intent.action.GET_CONTENT

android.intent.action.INSERT

android.intent.action.INSERT_OR_EDIT

android.intent.action.MAIN

android.intent.action.MEDIA_SEARCH

android.intent.action.PICK

android.intent.action.PICK_ACTIVITY

android.intent.action.RINGTONE_PICKER

android.intent.action.RUN

android.intent.action.SEARCH

android.intent.action.SEARCH_LONG_PRESS

android.intent.action.SEND

android.intent.action.SENDTO

android.intent.action.SET_WALLPAPER

android.intent.action.SYNC

android.intent.action.SYSTEM_TUTORIAL

android.intent.action.VIEW

android.intent.action.VOICE_COMMAND

android.intent.action.WEB_SEARCH

android.net.wifi.PICK_WIFI_NETWORK

android.settings.AIRPLANE_MODE_SETTINGS

android.settings.APN_SETTINGS

android.settings.APPLICATION_DEVELOPMENT_SETTINGS

android.settings.APPLICATION_SETTINGS

android.settings.BLUETOOTH_SETTINGS

android.settings.DATA_ROAMING_SETTINGS

android.settings.DATE_SETTINGS

android.settings.DISPLAY_SETTINGS

android.settings.INPUT_METHOD_SETTINGS

android.settings.INTERNAL_STORAGE_SETTINGS

android.settings.LOCALE_SETTINGS

android.settings.LOCATION_SOURCE_SETTINGS

android.settings.MANAGE_APPLICATIONS_SETTINGS

android.settings.MEMORY_CARD_SETTINGS

android.settings.NETWORK_OPERATOR_SETTINGS

android.settings.QUICK_LAUNCH_SETTINGS

android.settings.SECURITY_SETTINGS

android.settings.SETTINGS

android.settings.SOUND_SETTINGS

android.settings.SYNC_SETTINGS

android.settings.USER_DICTIONARY_SETTINGS

android.settings.WIFI_IP_SETTINGS

android.settings.WIFI_SETTINGS

android.settings.WIRELESS_SETTINGS

『捌』 android中intent的作用

意圖和意圖過濾器Intents and Intent Filters

一個應用程序的三個核心組件-活動,服務和廣播接收器是通過消息即意圖(Intents)來激活的。Intent息傳送是相同或不同應用中組件運行時晚綁定的一種機制。意圖本身,一個意圖對象,是一個包含被執行操作抽象描述的被動的數據結構-或者,對於廣播而言,是某件已經發生並被聲明的事情的描述。存在不同的機制來傳送意圖到每種組件中:
• 一個意圖對象是傳遞給Context.startActivity()或者Activity.startActivityForResult()來啟動一個活動或者讓一個存在的活動去做某些新的事情。
• 一個意圖對象是傳遞給Context.startService()來發起一個服務或者遞交新的指令給運行中的服務。類似的,一個意圖能被傳遞給Context.bindService() 來在調用組件和一個目標服務之間建立連接。作為一個可選項,它可以發起這個服務如果還沒運行的話。
• 傳遞給任意廣播方法(例如Context.sendBroadcast(),Context.sendOrderedBroadcast(), 或者Context.sendStickyBroadcast())的意圖對象被傳遞給所有感興趣的廣播接收者。許多種廣播產生於系統代碼。
在每個例子里,Android系統找到合適的活動,服務,或者一組廣播接收者來回應這個意圖,必要時實例化它們。這些消息傳送系統沒有重疊:廣播意圖僅被傳遞給廣播接收者,永遠不會給活動或者服務。一個傳送給startActivity()的意圖是只會被傳遞給一個活動,永遠不會給一個服務或廣播接收者,如此類推。
這篇文檔以意圖對象的描述開始,然後描述Android映射意圖到組件的規則-如何解決哪個組件應該接收一個意圖消息。對於沒有顯式命名一個目標組件的意圖,這個過程包括對照與潛在目標相關聯的意圖過濾器來測試這個意圖對象。

意圖對象Intent Objects
一個意圖Intent對象是一堆信息。它包含接收這個意圖的組件感興趣的信息(例如將要採取的動作和操作的數據)再加上Android系統感興趣的信息(例如應該處理這個意圖的組件類別和如何啟動一個目標活動的指令):
組件名稱Component name
應該處理這個意圖的組件名字. 這個欄位是一個ComponentName對象- 一個組合物:目標組件的完全合格的類名 (比如"com.example.project.app.FreneticActivity") 以及應用程序描述文件中設置的組件所在包的名字(比如, "com.example.project"). 這個組件名字的包部分和描述文件中設置的包名字不一定要匹配。
組件名字是可選的。如果被設置了,這個意圖對象將被傳遞到指定的類。如果沒有, Android使用另外的意圖對象中的信息去定位一個合適的目標- 請看本文稍後描述的意圖解析Intent Resolution。
組件名字通過如下方法:setComponent(),setClass(), 或者setClassName()設置並通過getComponent()讀取。

『玖』 android 裡面intent類干什麼的

intent即意圖
一:用來啟動其他新的Activity。
二:作為傳遞數據和事件的橋梁。傳遞數據時的代碼有兩種:
第一種是:
Intent
intent
=
new
Intent(CurrentActivity.this
,
OtherActivity.class);
intent.putExtra(「data」
,
somedata);
第二種是新建一個Bundle,再把該Bundle加入intent,如:
Bundle
bundle
=
new
Bundle()
;
bundle.putString(「data」
,
somedata)
;
intent.putExtras(bundle)。

熱點內容
androidactivity生命 發布:2024-04-27 07:33:48 瀏覽:83
win2008伺服器搭建網站 發布:2024-04-27 07:26:51 瀏覽:639
java的vector 發布:2024-04-27 07:05:00 瀏覽:203
舊電腦共享伺服器 發布:2024-04-27 06:32:21 瀏覽:339
java程序練習 發布:2024-04-27 06:24:00 瀏覽:438
sql30 發布:2024-04-27 06:22:10 瀏覽:55
怎樣防止sql注入 發布:2024-04-27 06:11:25 瀏覽:236
安卓為什麼不能登蘋果系統的游戲 發布:2024-04-27 06:11:23 瀏覽:601
編程日課 發布:2024-04-27 05:56:54 瀏覽:620
漏洞上傳工具 發布:2024-04-27 05:50:58 瀏覽:717