android 中intent是经常要用到的。不管是页面牵转,还是传递数据,或是调用外部程序,系统功能都要用到intent。
在做了一些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 = newIntent(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 = 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", "TheSMStext");
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","TheSMStext");
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","sometext");
startActivity(it);
StringBuilder sb= new StringBuilder();
sb.append("file://");
sb.append(fd.getAbsoluteFile());
Intent intent= newIntent(Intent.ACTION_SENDTO,Uri.fromParts("mmsto",number,null));
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:xxx@abc.com");
Intent it = newIntent(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,"Theemailbody text");
it.setType("text/plain");
startActivity(Intent.createChooser(it,"ChooseEmail 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,"Theemail body 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); 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"); 或者 Uri uri =Uri.parse("market://details?id=<packagename>"); Intent it = new Intent(Intent.ACTION_VIEW,uri);
startActivity(it); 17 寻找应用
Uri uri =Uri.parse("market://search?q=pname:pkg_name");
Intent it = new Intent(Intent.ACTION_VIEW,uri);
startActivity(it); 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.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 = newIntent(Intent.ACTION_INSERT_OR_EDIT);
intent.setType(People.CONTENT_ITEM_TYPE);
intent.putExtra(Contacts.Intents.Insert.NAME,"MyName");
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

Android系统调用的更多相关文章

  1. Hook android系统调用的实践

    本文博客地址:http://blog.csdn.net/qq1084283172/article/details/71037182 一.环境条件 Ubuntukylin 14.04.5 x64bit ...

  2. Hook android系统调用研究(一)

    本文的博客链接:http://blog.csdn.net/qq1084283172/article/details/55657300 一.Android内核源码的编译环境 系统环境:Ubuntu 14 ...

  3. Linux、Android系统调用从上层到底层的调用路径浅析

    参考: https://blog.csdn.net/liuhangtiant/article/details/85149369 http://blog.sina.com.cn/s/blog_79433 ...

  4. hook Android系统调用的乐趣和好处

    翻译:myswsun 0x00 前言 Android的内核是逆向工程师的好伙伴.虽然常规的Android应用被限制和沙盒化,逆向工程师可以按自己希望自定义和改变操作系统和内核中行为.这给了你不可多得的 ...

  5. Android BLE 蓝牙编程(一)

    最近在研究这个,等我有时间来写吧! 终于在端午节给自己放个假,现在就来说说关于android蓝牙ble的 最近的学习成果吧!! 需要材料(写个简单教程吧--关于小米手环的哦!嘿嘿) Android 手 ...

  6. 【Android UI】:Fragment官方文档

    概述   Fragment表现Activity中UI的一个行为或者一部分.可以将多个fragment组合在一起,放在一个单独的activity中来创建一个多界面区域的UI,并可以在多个activity ...

  7. Android源码分析之Looper

    先来说说summary,Looper就是用来在某个线程中跑一个message loop.一个线程默认是没有message loop与之相关联的, 为了创建一个你必须在这个线程中调用Looper.pre ...

  8. 【读书笔记《Android游戏编程之从零开始》】3.Android 游戏开发常用的系统控件(Button、Layout、ImageButton)

    3.1 Button Button这控件不用多说,就是一个按钮,主要是点击后进行相应事件的响应. 给组件添加ID属性:定义格式为 android:id="@+id/name",这里 ...

  9. Android清单文件详解(三)----应用程序的根节点<application>

    <application>节点是AndroidManifest.xml文件中必须持有的一个节点,它包含在<manifest>节点下.通过<application>节 ...

随机推荐

  1. 【BZOJ】3922: Karin的弹幕

    题意 给定一个长度为\(n(1 \le n \le 70000)\)序列,\(m(1 \le m \le 70000)\)次操作:1. 对一段下标是等差数列的子序列求最大值:2. 单点修改. 分析 如 ...

  2. JS:XML

    一 IE中的XML //1.创建XMLDOM对象 //创建XMLDOM对象 var xmlDom = new ActiveXObject("MSXML2.DOMDocument.6.0&qu ...

  3. 基于socket的TCP和UDP编程

    一.概述 TCP(传输控制协议)和UDP(用户数据报协议是网络体系结构TCP/IP模型中传输层一层中的两个不同的通信协议. TCP:传输控制协议,一种面向连接的协议,给用户进程提供可靠的全双工的字节流 ...

  4. 服务器中配置多个Tomcat及内存溢出配置

    1.更改server.xml文件中端口(启动.关闭端口) 2.在startup.bat文件开头加上 SET JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0 ...

  5. windows下读取磁盘扇区数据

    在Windows下,磁盘可以看做是一个文件,其文件名为\\\\.\\PhysicalDriveX,其中X表示磁盘的编号,例如\\\\.\\PhysicalDrive0表示的是第0号磁盘,如果需要读取一 ...

  6. Log4Net

    注意事项 <!-- The file log4Net.config is copied into bin/Debug /release by compiler 添加如下内容到 assemblyi ...

  7. jQuery命名空间,插件开发

    jQuery插件的开发包括两种: 一种是类级别的插件开发,即给jQuery添加新的全局函数,相当于给jQuery类本身添加方法.jQuery的全局函数就是属于jQuery命名空间的函数,另一种是对象级 ...

  8. PHP配置参数

    PHP使用到两个比较重要的配置文件: php.ini:决定php语言运行的环境,支持扩展的模块 , 开发环境的配置.(路径一般位于/etc/php.ini 或 /usr/local/php/etc/p ...

  9. 准备上线,切换到master分支,报错

    切换到master分支,准备上线,把上次上线sourceTree保存的修改拉出来: 运行,报错了: stackOverflow一搜说要删除旧的: 我show in finder 把他删了,然后双击安装 ...

  10. Mybatis与Spring整合,使用了maven管理项目,作为初学者觉得不错,转载下来

    转载自:http://www.cnblogs.com/xdp-gacl/p/4271627.html 一.搭建开发环境 1.1.使用Maven创建Web项目 执行如下命令: mvn archetype ...