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. msql数据迁移,myisam及innoDB

    直接迁移数据库文件. 一.MySQL数据库文件介绍 MySQL的每个数据库都对应存放在一个与数据库同名的文件夹中,MySQL数据库文件包括MySQL所建数据库文件和MySQL所用存储引擎创建的数据库文 ...

  2. 如何更好地学习dubbo源代码(转)

    很荣幸,作为这样一款业界使用率和好评率出众的RPC框架的维护者,今天这个文章主要是想帮助那些热爱开源的同学,更好的来研究dubbo的源代码. 一.Dubbo整体架构 1.Dubbo与Spring的整合 ...

  3. js中for in的用法

    for(var i=0;i<len;i++)这样的用法一般都可以用for in 来替代. 例如: var a = ["a","b","c&quo ...

  4. 如何完全卸载oracle11g?

    步骤一: 停止Oracle的所有服务. 步骤二: 运行%oracle_home%\app\Administrator\product\11.2.0\dbhome_1\deinstall \deinst ...

  5. 20145205《Java程序设计》第四次实验:Android环境搭建

    实验内容 1.搭建Android环境 2.运行Android 3.修改代码,能输出学号 实验步骤 搭建Android环境 安装Android,核心是配置JDK.SDK 运行Android 总结感想: ...

  6. “神马”框架之LigerUI

    我曾经参与一个产品的研发,前端框架用的就是LigerUI,之前我也没有听过这个框架. 因为是项目期初设计就定下来用LigerUI,根据系统的功能前端页面有跟多丰富的表现,所以需要改进前端效果,这次发现 ...

  7. JAVA中的TreeSet

    TreeSet简介 TreeSet是一个有序的集合,它的作用是提供一个有序的Set集合,它继承于AbstractSet抽象类实现了NavigableSet<E>, Cloneable, j ...

  8. 阿里云服务器Linux CentOS安装配置(零)目录

    阿里云服务器Linux CentOS安装配置(零)目录 阿里云服务器Linux CentOS安装配置(一)购买阿里云服务器 阿里云服务器Linux CentOS安装配置(二)yum安装svn 阿里云服 ...

  9. 总结-php

    strtr('li.a-o_lo.n_g-jun', '-_.', '+/=')  好高级啊 在tomcat里使用php用quercus PHP in java  http://quercus.cau ...

  10. pt-table-checksum和pt-heartbeat的使用

    一.pt-table-checksum 1.主从上均新建账户GRANT SELECT, PROCESS, SUPER, REPLICATION SLAVE ON *.* TO 'checksum'@' ...