摘要:android intent 和 intent action 大全
一、intent大全:
1.從google搜尋形式
Intent intent = new Intent();
intent.setAction( Intent.ACTION_WEB_SEARCH );
intent.putExtra( SearchManager.QUERY, "紅超的吾記之談" )//搜尋形式
startActivity( intent );
2.閱讀網頁
Uri uri = Uri.parse( "http://wzhnsc.blogspot.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 startLng&daddr=endLat endLng&hl=en" );
Intent it = new Intent( Intent.ACTION_VIEW, URI );
startActivity( it );
5.撥打電話
Uri uri = Uri.parse( "tel:110" );
Intent it = new Intent( Intent.ACTION_DIAL, uri );
startActivity( it );
6.發送短信
Uri uri = Uri.parse("smsto:123456"); //發送的電話號碼
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);//發送短信
intent.putExtra("sms_body", "我的博客網址是:http://wzhnsc.blogspot.com");//短信形式
startActivity(intent);
7.發送彩信
String path = android.os.Environment.getExternalStorageDirectory () + "/" + “image“;
Uri uri = Uri.parse(path);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra("sms_body", "彩信形式");//彩信形式
intent.putExtra("subject", "主題");//主題
intent.putExtra("address", "電話號碼");//電話號碼
intent.putExtra(Intent.EXTRA_STREAM, uri);//增加附件
intent.setType("image/jpg");//附件類型
startActivity(intent);
8.發送Email
Intent intent = new Intent(Intent.ACTION_SEND);
String[] sender = {"abc@163.com", "def@163.com"};//發送人email
String[] receiver = {aaa@qq.com, bbb@qq.com};//接納人email
intent.putExtra(Intent.EXTRA_EMAIL, sender);//發送人
intent.putExtra(Intent.EXTRA_CC, receiver);//接納人
intent.putExtra(Intent.EXTRA_TEXT, "email形式");//email形式
intent.putExtra(Intent.EXTRA_SUBJECT, "email主題");//email主題
intent.setType("message/rfc822");
startActivity(Intent.createChooser(intent, "Choose Email Client"));
9.播放音頻
Intent it = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.parse("file:///"+file.getPath());//文件地址
it.setDataAndType(uri, "audio/mp3");//mp3文件類型
startActivity(it);
10.uninstall apk
Uri uri = Uri.fromParts("package", “包名”, null);//包名
Intent it = new Intent(Intent.ACTION_DELETE, uri);//刪除包
startActivity(it);
11.install apk
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(“文件包地址”)), "application/vnd.android.package-archive");//裝置apk包
startActivity(intent);
12.從gallery選取圖片
Intent intent = new Intent();
intent.setType("image/*");//圖片類型
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent, 11);
13. 翻開錄音機
Intent intent = new Intent(Media.RECORD_SOUND_ACTION);//錄音機
startActivity(intent);
14.顯現使用具體列表
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id="+“包名”));//在電子市場翻開這個軟件
startActivity(intent);
15.調用零碎編輯增加聯絡人(全無效):
Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
intent.setType(People.CONTENT_ITEM_TYPE);
intent.putExtra(Contacts.Intents.Insert.NAME, contact_name.getText().toString());//聯絡人姓名
intent.putExtra(Contacts.Intents.Insert.PHONE, phone.getText());//電話號碼
intent.putExtra(Contacts.Intents.Insert.PHONE_TYPE ,
Contacts.PhonesColumns.TYPE_MOBILE);//增加的電話類型為:手機
intent.putExtra(Contacts.Intents.Insert.EMAIL, work_email.getText());//任務email
intent.putExtra(Contacts.Intents.Insert.EMAIL_TYPE ,
Contacts.ContactMethodsColumns.TYPE_WORK);//增加的email類型為:任務
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