1. 程式人生 > >Android action使用大全

Android action使用大全

1.Intent的用法:

(1)Action跳轉

1、 使用Action跳轉,當程式AndroidManifest.xml中某一個 Activity的IntentFilter定義了包含Action,如果恰好與目標Action匹配,且其IntentFilter中沒有定義其它的Type或Category過濾條件,那麼就正好匹配了。如果手機中有兩個以上的Action程式匹配,那麼就會彈出一個對話可框來提示說明。例如開啟一個網址,彈出可選對話方塊:


Action 的值在Android中有很多預定義,如果想直接轉到自己定義的Intent接收者,可以在接收者的IntentFilter 中加入一個自定義的Action值(同時要設定 Category值為"android.intent.category.DEFAULT"),在你的Intent中設定該值為Intent的 Action就直接能跳轉到你自己的Intent接收者中,因為這個Action在系統中是唯一的。

2、 data/type,可以用Uri 來做為data,比如Uri uri = Uri.parse(“http://blog.csdn.net/sunboy_2050); Intent i = new Intent(Intent.ACTION_VIEW, uri); 手機的Intent分發過程中,會根據“http://blog.csdn.net/sunboy_2050” 的scheme判斷出資料型別type。手機中安裝的所有Brower都能匹配它,在Brower的Manifest.xml中的IntenFilter中首先有ACTION_VIEW 的Action能處理http的type3、 Category分類,一般不要去在Intent中設定它,如果你寫Intent的接收者就在Manifest.xml的Activity的 IntentFilter中包含android.category.DEFAULT,這樣所有不設定 Category(Intent.addCategory(String c);)的Intent都會與這個Category匹配。4,extras 附加資訊,是其它所有附加資訊的集合。使用extras可以為元件提供擴充套件資訊,比如,如果要執行“傳送電子郵件”這個動作,可以將電子郵件的標題、正文等儲存在extras裡,傳給電子郵件傳送元件。(2)用類名跳轉
    Intent負責對應用中一次操作的動作、動作涉及的資料、附加資料進行描述,Android則根據此Intent的描述, 負責找到對應的元件,將 Intent傳遞給呼叫的元件,並完成元件的呼叫。Intent在這裡起著實現呼叫者與被呼叫者之間的解耦作用。Intent傳遞過程中,要找 到目標消費者(另一個Activity,IntentReceiver,Service),也就是Intent的響應者。Intent intent =new Intent();
intent.setClass(context, targetActivy.
class);  // 或者直接用 Intent intent = new Intent(context, targetActivity.class);
startActivity(intent);不過注意用類名跳轉,需要在AndroidManifest.xml中申明activity  <activity android:name="targetActivity"></activity>2. 幾種Intent的用法android 中intent是經常要用到的。不管是頁面牽轉,還是傳遞資料,或是呼叫外部程式,系統功能都要用到intent,下面是一些常用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("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.路徑規劃 
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.呼叫發簡訊的程式 
Intent it = new Intent(Intent.ACTION_VIEW);    
it.putExtra("sms_body", "The SMS text");    
it.setType("vnd.android-dir/mms-sms");    
startActivity(it); 

7.傳送簡訊 
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.傳送彩信 
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.傳送Email 
Uri uri = Uri.parse("mailto:[email protected]"); 
Intent it = new Intent(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, "The email 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, "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. 開啟照相機
 
    <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. 開啟錄音機 
   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, find the ID          
//by clicking on your application on Market home          
//page, and notice the ID from the address bar      

剛才找app id未果,結果發現用package name也可以 
Uri uri = Uri.parse("market://details?id=<packagename>"); 
這個簡單多了 

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 path for 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 = new ComponentName("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

附錄:

String

"android.intent.action.ADD_SHORTCUT"

動作:在系統中新增一個快捷方式。.

String

"android.intent.action.ALL_APPS"

動作:列舉所有可用的應用。

String

"android.intent.action.ANSWER"

動作:處理撥入的電話。

String

"android.intent.action.BUG_REPORT"

動作:顯示 activity 報告錯誤。

String

"android.intent.action.CALL"

動作:撥打電話,被呼叫的聯絡人在資料中指定。

String

"android.intent.action.CLEAR_CREDENTIALS"

動作:清除登陸憑證 (credential)。

String

"android.intent.action.VIEW"

動作:和 VIEW_ACTION 相同,是在資料上執行的標準動作。

String

"android.intent.action.DELETE"

動作:從容器中刪除給定的資料。

String

"android.intent.action.DIAL"

動作:撥打資料中指定的電話號碼。

String

"android.intent.action.EDIT"

動作:為制定的資料顯示可編輯介面。

String

"android.intent.action.EMERGENCY_DIAL"

動作:撥打緊急電話號碼。

String

"android.intent.action.LOGIN"

動作:獲取登入憑證。

String

"android.intent.action.MAIN"

動作:作為主入口點啟動,不需要資料。

String

"android.intent.action.PICK"

動作:從資料中選擇一個專案item,將被選中的專案返回。

String

"android.intent.action.PICK_ACTIVITY"

動作:選擇一個activity,返回被選擇的activity的類名

String

"android.intent.action.RUN"

動作:執行資料(指定的應用),無論它(應用)是什麼。

String

"android.intent.action.SENDTO"

動作:向 data 指定的接收者傳送一個訊息。

String

"android.intent.action.GET_CONTENT"

動作:讓使用者選擇資料並返回。

String

"android.intent.action.INSERT"

動作:在容器中插入一個空項 (item)。

String

"android.intent.action.SETTINGS"

動作:顯示系統設定。輸入:無。

String

"android.intent.action.VIEW"

動作:向用戶顯示資料。

String

"android.intent.action.WALLPAPER_SETTINGS"

動作:顯示選擇牆紙的設定介面。輸入:無。

String

"android.intent.action.WEB_SEARCH"

動作:執行 web 搜尋。

String

"android.intent.action.SYNC"

動作:執行資料同步。

String

"android.intent.action.SERVICE_STATE"

廣播:電話服務的狀態已經改變。

String

"android.intent.action.TIMEZONE_CHANGED"

廣播:時區已經改變。

String

"android.intent.action.TIME_SET"

廣播:時間已經改變(重新設定)。

String

"android.intent.action.TIME_TICK"

廣播:當前時間已經變化(正常的時間流逝)。

String

"android.intent.action.UMS_CONNECTED"

廣播:裝置進入 USB 大容量儲存模式。

String

"android.intent.action.UMS_DISCONNECTED"

廣播:裝置從 USB 大容量儲存模式退出。

String

"android.intent.action.WALLPAPER_CHANGED"

廣播:系統的牆紙已經改變。

String

"android.intent.action.XMPP_CONNECTED"

廣播:XMPP 連線已經被建立。

String

"android.intent.action.XMPP_DI

廣播:XMPP 連線已經被斷開。

String

"android.intent.action.SIG_STR"

廣播:電話的訊號強度已經改變。

String

"android.intent.action.BATTERY_CHANGED"

廣播:充電狀態,或者電池的電量發生變化。

String

"android.intent.action.BOOT_COMPLETED"

廣播:在系統啟動後,這個動作被廣播一次(只有一次)

String

"android.intent.action.DATA_ACTIVITY"

廣播:電話的資料活動(data activity)狀態已經改變

String

"android.intent.action.DATA_STATE"

廣播:電話的資料連線狀態已經改變。

String

"android.intent.action.DATE_CHANGED"

廣播:日期被改變。

String

"android.server.checkin.FOTA_CANCEL"

廣播:取消所有被掛起的 (pending) 更新下載。

String

"android.server.checkin.FOTA_INSTALL"

廣播:更新已經被確認,馬上就要開始安裝。

String

"android.server.checkin.FOTA_READY"

廣播:更新已經被下載,可以開始安裝。

String

"android.server.checkin.FOTA_RESTART"

廣播:恢復已經停止的更新下載。

String

"android.server.checkin.FOTA_UPDATE"

廣播:通過 OTA 下載並安裝作業系統更新。

String

"android.intent.action.MEDIABUTTON"

廣播:使用者按下了“Media Button”。

String

"android.intent.action.MEDIA_BAD_REMOVAL"

廣播:擴充套件卡從SD卡插槽拔出,但是掛載點還沒unmount。

String

"android.intent.action.MEDIA_EJECT"

廣播:使用者想要移除擴充套件介質(拔掉擴充套件卡)。

String

"android.intent.action.MEDIA_MOUNTED"

廣播:擴充套件介質被插入,而且已經被掛載。

String

"android.intent.action.MEDIA_REMOVED"

廣播:擴充套件介質被移除。

String

"android.intent.action.MEDIA_SCANNER_FINISHED"

廣播:已經掃描完介質的一個目錄。

String

"android.intent.action.MEDIA_SCANNER_STARTED"

廣播:開始掃描介質的一個目錄。

String

"android.intent.action.MEDIA_SHARED"

廣播:擴充套件介質的掛載被解除 (unmount)

String

"android.intent.action.MEDIA_UNMOUNTED"

廣播:擴充套件介質存在,但是還沒有被掛載 (mount)。

String

"android.intent.action.MWI"

廣播:電話的訊息等待(語音郵件)狀態已經改變。

String

"android.intent.action.PACKAGE_ADDED"

廣播:裝置上新安裝了一個應用程式包。

String

"android.intent.action.PACKAGE_REMOVED"

廣播:裝置上刪除了一個應用程式包。

String

"android.intent.action.PHONE_STATE"

廣播:電話狀態已經改變。

String

"android.intent.action.PROVIDER_CHANGED"

廣播:更新將要(真正)被安裝。

String

"android.intent.action.PROVISIONING_CHECK"

廣播:要求provisioning service下載最新的設定

String

"android.intent.action.SCREEN_OFF"

廣播:螢幕被關閉。

String

"android.intent.action.SCREEN_ON"

廣播:螢幕已經被開啟。

String

"android.intent.action.NETWORK_TICKLE_RECEIVED"

廣播:裝置收到了新的網路 "tickle" 通知。

String

"android.intent.action.STATISTICS_REPORT"

廣播:要求 receivers 報告自己的統計資訊。

String

"android.intent.action.STATISTICS_STATE_CHANGED"

廣播:統計資訊服務的狀態已經改變。

String

"android.intent.action.CFF"

廣播:語音電話的來電轉駁狀態已經改變。

String

"android.intent.action.CONFIGURATION_CHANGED"

廣播:裝置的配置資訊已經改變,參見 Resources.Configuration

String

"android.intent.category.ALTERNATIVE"

類別:說明activity是使用者正在瀏的資料的一個可選操作。

String

"android.intent.category.WALLPAPER"

類別:這個 activity 能過為裝置設定牆紙。

String

"android.intent.category.UNIT_TEST"

類別:應該被用作單元測試(通過 test harness 執行)。

String

"android.intent.category.TEST"

類別:作為測試目的使用,不是正常的使用者體驗的一部分。

String

"android.intent.category.TAB"

類別:activity應該在TabActivity中作為一個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是一個設定面板 (preference panel)。

String

"android.intent.category.HOME"

類別:主螢幕 (activity),裝置啟動後顯示的第一個 activity。

String

"android.intent.category.BROWSABLE"

類別:能夠被瀏覽器安全使用的 activities 必須支援這個類別。

String

"android.intent.category.DEFAULT"

類別:如果 activity 是對資料執行確省動作(點選, center press)的一個選項,需要設定這個類別。

String

"android.intent.category.DEVELOPMENT_PREFERENCE"

類別:說明 activity 是一個設定面板 (development preference panel).

String

"android.intent.category.EMBED"

類別:能夠在上級(父)activity 中執行。

String

"android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST"

類別:To be used as code under test for framework instrumentation tests.

String

"android.intent.category.GADGET"

類別:這個 activity 可以被嵌入宿主 activity (activity that is hosting gadgets)。

String

"android.intent.category.LAUNCHER"

類別:Activity 應該被顯示在頂級的 launcher 中。

String

"android.intent.category.SELECTED_ALTERNATIVE"

類別:對於被使用者選中的資料,activity 是它的一個可選操作。

int

8 0x00000008

啟動標記:和 NEW_TASK_LAUNCH 聯合使用,禁止將已有的任務改變為前景任務 (foreground)。

int

4 0x00000004

啟動標記:設定以後,activity 將成為歷史堆疊中的第一個新任務(棧頂)。

int

1 0x00000001

啟動標記:設定以後,新的 activity 不會被儲存在歷史堆疊中。

int

2 0x00000002

啟動標記:設定以後,如果 activity 已經啟動,而且位於歷史堆疊的頂端,將不再啟動(不重新啟動) activity。

int

16 0x00000010

啟動標記:如果這個標記被設定,而且被一個已經存在的 activity 用來啟動新的 activity,已有 activity 的回覆目標 (reply target) 會被轉移給新的 activity。

String

"android.intent.extra.INTENT"

附加資料:和 PICK_ACTIVITY_ACTION 一起使用時,說明使用者選擇的用來顯示的 activity;和 ADD_SHORTCUT_ACTION 一起使用的時候,描述要新增的快捷方式。

String

"android.intent.extra.LABEL"

附加資料:大寫字母開頭的字元標籤,和 ADD_SHORTCUT_ACTION 一起使用。

String

"android.intent.extra.TEMPLATE"

附加資料:新記錄的初始化模板。

Creator


參考推薦:

相關推薦

Android 廣播大全 Intent Action 事件

Intent.ACTION_AIRPLANE_MODE_CHANGED; //關閉或開啟飛航模式時的廣播 Intent.ACTION_BATTERY_CHANGED; //充電狀態,或者電池的電量發生變化 //電池的充電狀態、電荷級別改變,不能通過組建宣告接收這

Android action使用大全

1.Intent的用法:(1)Action跳轉1、 使用Action跳轉,當程式AndroidManifest.xml中某一個 Activity的IntentFilter定義了包含Action,如果恰好與目標Action匹配,且其IntentFilter中沒有定義其它的Type或Category過濾條件,那

android Toast大全(五種情形)建立屬於你自己的Toast

right 其它 activity make div ins case tco title 搬運而來,如有雷同。絕非意外! Toast用於向用戶顯示一些幫助/提示。以下我做了5中效果,來說明Toast的強大,定義一個屬於你自己的Toast。

【筆記】Android許可權大全

訪問登記屬性 android.permission.ACCESS_CHECKIN_PROPERTIES ,讀取或寫入登記check-in資料庫屬性表的許可權 獲取錯略位置 android.permission.ACCESS_COA

Android許可權大全

1.android.permission.WRITE_USER_DICTIONARY 允許應用程式向用戶詞典中寫入新詞 2.android.permission.WRITE_SYNC_SETTINGS 寫入Google線上同步設定 3.android.p

Android 框架大全

說明 Android經常使用的框架,儘管有些沒有使用,但是還有有必要進一步學習的,比如熱更新框架。 表格 框架名稱   上榜關鍵字 1.Ret

Android許可權大全 (android.permission)

在Android的設計中,資源的訪問或者網路連線,要得到這些服務都需要宣告其訪問許可權,否則將無法正常工作。在Android中這樣的許可權有很多種,這裡將各類訪問許可權一一羅列出來,供大家使用時參考之用。 android.permission.EXPAND_STATUS_BAR允許一

Android異常大全

java.lang.NullPointerException這個異常的解釋是 "程式遇上了空指標 ",簡單地說就是呼叫了未經初始化的物件或者是不存在的物件,這個錯誤經常出現在建立圖片,呼叫陣列這些操作中,比如圖片未經初始化,或者圖片建立時的路徑錯誤等等。對陣列操作中出現空指標,即把陣列的初始化和陣列元素的初

Android 屬性大全

抽時間把以前積累的屬性整理了一份,分享給大家 android:alpha setAlpha(float) 屬性說明: 檢視透明度,值在0-1之間。0為完全透明,1為完全不透明。 android:background setBackgroundResource(int

2017年Android一百個框架排行榜,2017年Android框架大全

排行榜包括四大類: 單一框架:僅提供路由、網路層、UI層、通訊層或其他單一功能的框架 混合開發框架:提供開發hybrid app、h5與webview結合能力、web app能力的框架 企業級開源專案:可以獨立執行的app,有極高的學習價值、思路借鑑意義

Android action bar 為什麼有時有,有時沒有

今天碰到actionBar在一些頁面出現,在另外一些頁面沒有出現的問題。不知道回事,在那找bug。找了老半天,也不知道怎麼回事。折騰了一上午。最後才知道是沒有在activity裡覆蓋父類的 onCreateOptionsMenu()方法: public boolean on

最流行的android元件大全

Android 是目前最流行的移動作業系統(還需要加之一嗎?)。 隨著新版本的不斷髮布, Android的功能也日益強大, 湧現了很多流行的應用程式, 也催生了一大批的優秀的元件。 本文試圖將目前流行的元件收集起來以供參考, 如果你發現本文還沒有列出的元件,歡迎在評論中貼出來,我會定期的更新本文。 以下是我

android專案大全,總有你所需的

注:開啟請貼網址,有些直接通過連結開啟的不正確。  1.相對佈局例項 http://kukuqiu.iteye.com/blog/1018396 手機通話監聽,一套停車場管理軟體原始碼 http://www.eoeandroid.com/thread-31080

轉:Android 外部啟動activity,自定義actionaction常量大全

https://www.cnblogs.com/guop/p/5067342.html Android 外部啟動activity,自定義action,action常量大全 從任意app,啟動另外一個app的activity: 1.   Intent i =

Android 外部啟動activity,自定義actionaction常量大全

https://www.cnblogs.com/guop/p/5067342.html 從任意app,啟動另外一個app的activity: 1.   Intent i = new Intent();        &

Androidandroid studio快捷鍵大全

構造 F12 重寫 template 類的方法 alt 參數 ctrl+ 代碼 一、常用快捷鍵  1.Ctrl+E,可以顯示最近編輯的文件列表  2.Shift+Click可以關閉文件  3.Ctrl+[或]可以跳到大括號的開頭結尾  4.Ctrl+Shift+Backsp

android權限(permission)大全

wid 刪除 tro ica guard 格式 時區 禁用 經緯度 此文章由情緒控撰寫,轉載請註明此處!!! 1.android.permission.WRITE_USER_DICTIONARY 同意應用程序向用戶詞典中寫入新詞 2.android.permissi

Android layout屬性大全

android ont roi http 布局 csdn -name str tail 第一類:屬性值 true或者 false 1:android:layout_alignParentStart緊貼父元素結束位置開始 2:android:layout_alignPar

Android 圖片壓縮的方法大全

方法 nal ons arr reset 註意 you 固定 .com public static Bitmap revitionImageSize(String path) throws IOException { BufferedInputStream in

Android零基礎入門第22節:ImageView的屬性和方法大全

子類 parent ide eight odin 使用詳解 統架構 討論 架構 通過前面幾期的學習,TextView控件及其子控件基本學習完成,可以在Android屏幕上顯示一些文字或者按鈕,那麽從本期開始來學習如何在進行圖片展示,這就是涉及到另外一個非常重要的控件家族,那