1.Intent的用法:
(1) Action跳轉(zhuǎn)
1、 使用Action跳轉(zhuǎn),當(dāng)程序AndroidManifest.xml中某一個(gè) Activity的IntentFilter定義了包含Action,如果恰好與目標(biāo)Action匹配,且其IntentFilter中沒有定義其它的Type或Category過濾條件,那么就正好匹配了。如果手機(jī)中有兩個(gè)以上的Action程序匹配,那么就會(huì)彈出一個(gè)對(duì)話可框來提示說明。例如打開一個(gè)網(wǎng)址,彈出可選對(duì)話框:
Action 的值在Android中有很多預(yù)定義,如果想直接轉(zhuǎn)到自己定義的Intent接收者,可以在接收者的IntentFilter 中加入一個(gè)自定義的Action值(同時(shí)要設(shè)定 Category值為"android.intent.category.DEFAULT"),在你的Intent中設(shè)定該值為Intent的 Action就直接能跳轉(zhuǎn)到你自己的Intent接收者中,因?yàn)檫@個(gè)Action在系統(tǒng)中是唯一的。
intent.setClass(context, targetActivy. class ); // 或者直接用 Intent intent = new Intent(context, targetActivity.class);
1.從google搜索內(nèi)容
Intent intent = new Intent();
intent.setAction(Intent.ACTION_WEB_SEARCH);
intent.putExtra(SearchManager.QUERY,"searchString")
startActivity(intent);
2.瀏覽網(wǎng)頁(yè)
Uri uri = Uri.parse("http://www.google.com");
Intent it= new Intent(Intent.ACTION_VIEW,uri);
startActivity(it);
3.顯示地圖
Uri uri = Uri.parse("geo:38.899533,-77.036476");
Intent it = new Intent(Intent.Action_VIEW,uri);
startActivity(it);
4.路徑規(guī)劃
Uri uri = Uri.parse("http://maps.google.com/maps?f=dsaddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");
Intent it = new Intent(Intent.ACTION_VIEW,URI);
startActivity(it);
5.撥打電話
Uri uri = Uri.parse("tel:xxxxxx");
Intent it = new Intent(Intent.ACTION_DIAL, uri);
startActivity(it);
6.調(diào)用發(fā)短信的程序
Intent it = new Intent(Intent.ACTION_VIEW);
it.putExtra("sms_body", "The SMS text");
it.setType("vnd.android-dir/mms-sms");
startActivity(it);
7.發(fā)送短信
Uri uri = Uri.parse("smsto:0800000123");
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
it.putExtra("sms_body", "The SMS text");
startActivity(it);
String body="this is sms demo";
Intent mmsintent = new Intent(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.發(fā)送彩信
Uri uri = Uri.parse("content://media/external/images/media/23");
Intent it = new Intent(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 = new Intent(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.發(fā)送Email
Uri uri = Uri.parse("mailto:xxx@abc.com");
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
startActivity(it);
Intent it = new Intent(Intent.ACTION_SEND);
it.putExtra(Intent.EXTRA_EMAIL, "me@abc.com");
it.putExtra(Intent.EXTRA_TEXT, "The email body text");
it.setType("text/plain");
startActivity(Intent.createChooser(it, "Choose Email Client"));
Intent it=new Intent(Intent.ACTION_SEND);
String[] tos={"me@abc.com"};
String[] ccs={"you@abc.com"};
it.putExtra(Intent.EXTRA_EMAIL, tos);
it.putExtra(Intent.EXTRA_CC, ccs);
it.putExtra(Intent.EXTRA_TEXT, "The email body text");
it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");
it.setType("message/rfc822");
startActivity(Intent.createChooser(it, "Choose Email Client"));
Intent it = new Intent(Intent.ACTION_SEND);
it.putExtra(Intent.EXTRA_SUBJECT, "The email 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 = new Intent(Intent.ACTION_DELETE, uri);
startActivity(it);
12.install apk
Uri installUri = Uri.fromParts("package", "xxx", null);
returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
13. 打開照相機(jī)
<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);
15. 打開錄音機(jī)
Intent mi = new Intent(Media.RECORD_SOUND_ACTION);
startActivity(mi);
16.顯示應(yīng)用詳細(xì)列表
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, find the ID
//by clicking on your application on Market home
//page, and notice the ID from the address bar
剛才找app id未果,結(jié)果發(fā)現(xiàn)用package name也可以
Uri uri = Uri.parse("market://details?id=<packagename>");
這個(gè)簡(jiǎn)單多了
17尋找應(yīng)用
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 path for an application
18打開聯(lián)系人列表
<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 = new ComponentName("com.yellowbook.android2",
"com.yellowbook.android2.AndroidSearch");
i.setComponent(cn);
i.setAction("android.intent.action.MAIN");
startActivityForResult(i, RESULT_OK);
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.調(diào)用系統(tǒng)編輯添加聯(lián)系人(全有效):
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, "com@com.com");
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
附錄:
String |
"android.intent.action.ADD_SHORTCUT" |
動(dòng)作:在系統(tǒng)中添加一個(gè)快捷方式。. |
String |
"android.intent.action.ALL_APPS" |
動(dòng)作:列舉所有可用的應(yīng)用。 |
String |
"android.intent.action.ANSWER" |
動(dòng)作:處理?yè)苋氲碾娫挕? |
String |
"android.intent.action.BUG_REPORT" |
動(dòng)作:顯示 activity報(bào)告錯(cuò)誤。 |
String |
"android.intent.action.CALL" |
動(dòng)作:撥打電話,被呼叫的聯(lián)系人在數(shù)據(jù)中指定。 |
String |
"android.intent.action.CLEAR_CREDENTIALS" |
動(dòng)作:清除登陸憑證 (credential)。 |
String |
"android.intent.action.VIEW" |
動(dòng)作:和 VIEW_ACTION相同,是在數(shù)據(jù)上執(zhí)行的標(biāo)準(zhǔn)動(dòng)作。 |
String |
"android.intent.action.DELETE" |
動(dòng)作:從容器中刪除給定的數(shù)據(jù)。 |
String |
"android.intent.action.DIAL" |
動(dòng)作:撥打數(shù)據(jù)中指定的電話號(hào)碼。 |
String |
"android.intent.action.EDIT" |
動(dòng)作:為制定的數(shù)據(jù)顯示可編輯界面。 |
String |
"android.intent.action.EMERGENCY_DIAL" |
動(dòng)作:撥打緊急電話號(hào)碼。 |
String |
"android.intent.action.LOGIN" |
動(dòng)作:獲取登錄憑證。 |
String |
" android.intent.action.MAIN " |
動(dòng)作:作為主入口點(diǎn)啟動(dòng),不需要數(shù)據(jù)。 |
String |
"android.intent.action.PICK" |
動(dòng)作:從數(shù)據(jù)中選擇一個(gè)項(xiàng)目item,將被選中的項(xiàng)目返回。 |
String |
"android.intent.action.PICK_ACTIVITY" |
動(dòng)作:選擇一個(gè)activity,返回被選擇的activity的類名 |
String |
"android.intent.action.RUN" |
動(dòng)作:運(yùn)行數(shù)據(jù)(指定的應(yīng)用),無(wú)論它(應(yīng)用)是什么。 |
String |
"android.intent.action.SENDTO" |
動(dòng)作:向 data指定的接收者發(fā)送一個(gè)消息。 |
String |
"android.intent.action.GET_CONTENT" |
動(dòng)作:讓用戶選擇數(shù)據(jù)并返回。 |
String |
"android.intent.action.INSERT" |
動(dòng)作:在容器中插入一個(gè)空項(xiàng) (item)。 |
String |
"android.intent.action.SETTINGS" |
動(dòng)作:顯示系統(tǒng)設(shè)置。輸入:無(wú)。 |
String |
" android.intent.action.VIEW " |
動(dòng)作:向用戶顯示數(shù)據(jù)。 |
String |
"android.intent.action.WALLPAPER_SETTINGS" |
動(dòng)作:顯示選擇墻紙的設(shè)置界面。輸入:無(wú)。 |
String |
"android.intent.action.WEB_SEARCH" |
動(dòng)作:執(zhí)行 web搜索。 |
String |
"android.intent.action.SYNC" |
動(dòng)作:執(zhí)行數(shù)據(jù)同步。 |
String |
"android.intent.action.SERVICE_STATE" |
廣播:電話服務(wù)的狀態(tài)已經(jīng)改變。 |
String |
"android.intent.action.TIMEZONE_CHANGED" |
廣播:時(shí)區(qū)已經(jīng)改變。 |
String |
"android.intent.action.TIME_SET" |
廣播:時(shí)間已經(jīng)改變(重新設(shè)置)。 |
String |
"android.intent.action.TIME_TICK" |
廣播:當(dāng)前時(shí)間已經(jīng)變化(正常的時(shí)間流逝)。 |
String |
"android.intent.action.UMS_CONNECTED" |
廣播:設(shè)備進(jìn)入 USB大容量存儲(chǔ)模式。 |
String |
"android.intent.action.UMS_DISCONNECTED" |
廣播:設(shè)備從 USB大容量存儲(chǔ)模式退出。 |
String |
"android.intent.action.WALLPAPER_CHANGED" |
廣播:系統(tǒng)的墻紙已經(jīng)改變。 |
String |
"android.intent.action.XMPP_CONNECTED" |
廣播:XMPP連接已經(jīng)被建立。 |
String |
"android.intent.action.XMPP_DI |
廣播:XMPP連接已經(jīng)被斷開。 |
String |
"android.intent.action.SIG_STR" |
廣播:電話的信號(hào)強(qiáng)度已經(jīng)改變。 |
String |
"android.intent.action.BATTERY_CHANGED" |
廣播:充電狀態(tài),或者電池的電量發(fā)生變化。 |
String |
" android.intent.action.BOOT_COMPLETED " |
廣播:在系統(tǒng)啟動(dòng)后,這個(gè)動(dòng)作被廣播一次(只有一次) |
String |
"android.intent.action.DATA_ACTIVITY" |
廣播:電話的數(shù)據(jù)活動(dòng)(data activity)狀態(tài)已經(jīng)改變 |
String |
"android.intent.action.DATA_STATE" |
廣播:電話的數(shù)據(jù)連接狀態(tài)已經(jīng)改變。 |
String |
"android.intent.action.DATE_CHANGED" |
廣播:日期被改變。 |
String |
"android.server.checkin.FOTA_CANCEL" |
廣播:取消所有被掛起的 (pending)更新下載。 |
String |
"android.server.checkin.FOTA_INSTALL" |
廣播:更新已經(jīng)被確認(rèn),馬上就要開始安裝。 |
String |
"android.server.checkin.FOTA_READY" |
廣播:更新已經(jīng)被下載,可以開始安裝。 |
String |
"android.server.checkin.FOTA_RESTART" |
廣播:恢復(fù)已經(jīng)停止的更新下載。 |
String |
"android.server.checkin.FOTA_UPDATE" |
廣播:通過 OTA下載并安裝操作系統(tǒng)更新。 |
String |
"android.intent.action.MEDIABUTTON" |
廣播:用戶按下了“Media Button”。 |
String |
"android.intent.action.MEDIA_BAD_REMOVAL" |
廣播:擴(kuò)展卡從SD卡插槽拔出,但是掛載點(diǎn)還沒unmount。 |
String |
"android.intent.action.MEDIA_EJECT" |
廣播:用戶想要移除擴(kuò)展介質(zhì)(拔掉擴(kuò)展卡)。 |
String |
"android.intent.action.MEDIA_MOUNTED" |
廣播:擴(kuò)展介質(zhì)被插入,而且已經(jīng)被掛載。 |
String |
"android.intent.action.MEDIA_REMOVED" |
廣播:擴(kuò)展介質(zhì)被移除。 |
String |
"android.intent.action.MEDIA_SCANNER_FINISHED" |
廣播:已經(jīng)掃描完介質(zhì)的一個(gè)目錄。 |
String |
"android.intent.action.MEDIA_SCANNER_STARTED" |
廣播:開始掃描介質(zhì)的一個(gè)目錄。 |
String |
"android.intent.action.MEDIA_SHARED" |
廣播:擴(kuò)展介質(zhì)的掛載被解除 (unmount) |
String |
" android.intent.action.MEDIA_UNMOUNTED " |
廣播:擴(kuò)展介質(zhì)存在,但是還沒有被掛載 (mount)。 |
String |
"android.intent.action.MWI" |
廣播:電話的消息等待(語(yǔ)音郵件)狀態(tài)已經(jīng)改變。 |
String |
" android.intent.action.PACKAGE_ADDED " |
廣播:設(shè)備上新安裝了一個(gè)應(yīng)用程序包。 |
String |
" android.intent.action.PACKAGE_REMOVED " |
廣播:設(shè)備上刪除了一個(gè)應(yīng)用程序包。 |
String |
"android.intent.action.PHONE_STATE" |
廣播:電話狀態(tài)已經(jīng)改變。 |
String |
"android.intent.action.PROVIDER_CHANGED" |
廣播:更新將要(真正)被安裝。 |
String |
"android.intent.action.PROVISIONING_CHECK" |
廣播:要求provisioning service下載最新的設(shè)置 |
String |
"android.intent.action.SCREEN_OFF" |
廣播:屏幕被關(guān)閉。 |
String |
"android.intent.action.SCREEN_ON" |
廣播:屏幕已經(jīng)被打開。 |
String |
"android.intent.action.NETWORK_TICKLE_RECEIVED" |
廣播:設(shè)備收到了新的網(wǎng)絡(luò) "tickle"通知。 |
String |
"android.intent.action.STATISTICS_REPORT" |
廣播:要求 receivers報(bào)告自己的統(tǒng)計(jì)信息。 |
String |
"android.intent.action.STATISTICS_STATE_CHANGED" |
廣播:統(tǒng)計(jì)信息服務(wù)的狀態(tài)已經(jīng)改變。 |
String |
"android.intent.action.CFF" |
廣播:語(yǔ)音電話的呼叫轉(zhuǎn)移狀態(tài)已經(jīng)改變。 |
String |
"android.intent.action.CONFIGURATION_CHANGED" |
廣播:設(shè)備的配置信息已經(jīng)改變,參見 Resources.Configuration |
String |
"android.intent.category.ALTERNATIVE" |
類別:說明activity是用戶正在瀏的數(shù)據(jù)的一個(gè)可選操作。 |
String |
"android.intent.category.WALLPAPER" |
類別:這個(gè) activity能過為設(shè)備設(shè)置墻紙。 |
String |
"android.intent.category.UNIT_TEST" |
類別:應(yīng)該被用作單元測(cè)試(通過 test harness運(yùn)行)。 |
String |
"android.intent.category.TEST" |
類別:作為測(cè)試目的使用,不是正常的用戶體驗(yàn)的一部分。 |
String |
"android.intent.category.TAB" |
類別:activity應(yīng)該在TabActivity中作為一個(gè)tab使用 |
String |
"android.intent.category.SAMPLE_CODE" |
類別:To be used as an sample code example (not part of the normal user experience). |
String |
"android.intent.category.PREFERENCE" |
類別:activity是一個(gè)設(shè)置面板 (preference panel)。 |
String |
"android.intent.category.HOME" |
類別:主屏幕 (activity),設(shè)備啟動(dòng)后顯示的第一個(gè) activity。 |
String |
"android.intent.category.BROWSABLE" |
類別:能夠被瀏覽器安全使用的 activities必須支持這個(gè)類別。 |
String |
"android.intent.category.DEFAULT" |
類別:如果 activity是對(duì)數(shù)據(jù)執(zhí)行確省動(dòng)作(點(diǎn)擊, center press)的一個(gè)選項(xiàng),需要設(shè)置這個(gè)類別。 |
String |
"android.intent.category.DEVELOPMENT_PREFERENCE" |
類別:說明 activity是一個(gè)設(shè)置面板 (development preference panel). |
String |
"android.intent.category.EMBED" |
類別:能夠在上級(jí)(父)activity中運(yùn)行。 |
String |
"android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" |
類別:To be used as code under test for framework instrumentation tests. |
String |
"android.intent.category.GADGET" |
類別:這個(gè) activity可以被嵌入宿主 activity (activity that is hosting gadgets)。 |
String |
"android.intent.category.LAUNCHER" |
類別:Activity應(yīng)該被顯示在頂級(jí)的 launcher 中。 |
String |
"android.intent.category.SELECTED_ALTERNATIVE" |
類別:對(duì)于被用戶選中的數(shù)據(jù),activity是它的一個(gè)可選操作。 |
int |
8 0x00000008 |
啟動(dòng)標(biāo)記:和 NEW_TASK_LAUNCH聯(lián)合使用,禁止將已有的任務(wù)改變?yōu)榍熬叭蝿?wù) (foreground)。 |
int |
4 0x00000004 |
啟動(dòng)標(biāo)記:設(shè)置以后,activity將成為歷史堆棧中的第一個(gè)新任務(wù)(棧頂)。 |
int |
1 0x00000001 |
啟動(dòng)標(biāo)記:設(shè)置以后,新的 activity不會(huì)被保存在歷史堆棧中。 |
int |
2 0x00000002 |
啟動(dòng)標(biāo)記:設(shè)置以后,如果 activity已經(jīng)啟動(dòng),而且位于歷史堆棧的頂端,將不再啟動(dòng)(不重新啟動(dòng)) activity。 |
int |
16 0x00000010 |
啟動(dòng)標(biāo)記:如果這個(gè)標(biāo)記被設(shè)置,而且被一個(gè)已經(jīng)存在的 activity用來啟動(dòng)新的 activity,已有 activity 的回復(fù)目標(biāo) (reply target) 會(huì)被轉(zhuǎn)移給新的 activity。 |
String |
"android.intent.extra.INTENT" |
附加數(shù)據(jù):和 PICK_ACTIVITY_ACTION一起使用時(shí),說明用戶選擇的用來顯示的 activity;和 ADD_SHORTCUT_ACTION 一起使用的時(shí)候,描述要添加的快捷方式。 |
String |
"android.intent.extra.LABEL" |
附加數(shù)據(jù):大寫字母開頭的字符標(biāo)簽,和 ADD_SHORTCUT_ACTION一起使用。 |
String |
"android.intent.extra.TEMPLATE" |
附加數(shù)據(jù):新記錄的初始化模板。 |
Creator |
無(wú) |
無(wú) |
參考推薦:
intent
(google)
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
