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. ZeroMQ接口函数之 :zmq_z85_encode – 使用Z85算法对一个二进制秘钥进行加密,输出可打印的文本

    ZeroMQ 官方地址 :http://api.zeromq.org/4-0:zmq-z85-encode zmq_z85_encode(3)          ØMQ Manual - ØMQ/4. ...

  2. 【WPF】绑定数据

    WPF绑定数据 模型类(继承 INotifyPropertyChanged,实现属性的变更通知)

  3. java面向对象_抽象类和接口

    一.抽象类 1.抽象方法:由abstract修饰.只有定义没有方法体.用一个分号结尾. 2.抽象类: 1)包含抽象方法的类必须是抽象类 2)由abstract修饰 3)不能被实例化 4)抽象类如果不被 ...

  4. VS2010/VS2013中ashx代码折叠的问题

    Tools->Options->TextEditor->File Extension Add ashx Microsoft Visual C# Apply OK 重启VS就可以了,效 ...

  5. [IT新应用]家用NAS,自建“360云盘”

    360云盘也快要离开了.同事中有人开始尝试使用群晖NAS.西数的NAS来自建云了. [功能对比] [选择参数] [口碑评价]

  6. track message forwards, avoiding request loops, and identifying the protocol capabilities of all senders along the request/response chain

    https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html The TRACE method is used to invoke a remote, ...

  7. android ANR产生原因和解决办法【转】

    ANR (Application Not Responding) ANR定义:在Android上,如果你的应用程序有一段时间响应不够灵敏,系统会向用户显示一个对话框,这个对话框称作应用程序无响应(AN ...

  8. SQL PRIMARY KEY 约束\SQL FOREIGN KEY 约束\SQL CHECK 约束

    SQL PRIMARY KEY 约束 PRIMARY KEY 约束唯一标识数据库表中的每条记录. 主键必须包含唯一的值. 主键列不能包含 NULL 值. 每个表都应该有一个主键,并且每个表只能有一个主 ...

  9. PHP preg_replace使用例子

    将 qwer://xxx/545/0 替换为 qwer://trading_system_xxx/0/545 $str = '<a href="qwer://xxx/545/0&quo ...

  10. VS2015编译Qt5.7.0生成支持XP的静态库(很不错)

    一.编译工具 1.VS2015 编译Qt5.7.0的所需VS版本:Visual Studio 2013 (Update1)或Visual Studio 2015 (Update2).因为Update补 ...