intent的几种常用用法_第1页
intent的几种常用用法_第2页
intent的几种常用用法_第3页
intent的几种常用用法_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、.Intent的几种用法 · 博客分类:· AndroidAndroidGoogleF#下面列出几种Intent的用法显示网页:1 Uri uri = Uri.parse" :/ google "2 Intent it = new IntentIntent.ACTION_VIEW,uri;3 startActivityit;显示地图:4 Uri uri = Uri.parse"geo:38.899533,-77.036476"5 Intent it = new IntentIntent.Action_VIEW,uri;6 startA

2、ctivityit;途径规划:7 Uri uri = Uri.parse" :/maps.google /maps?f=d&saddr=startLat%20startLng&daddr=endLat%20endLng&hl=en"8 Intent it = new IntentIntent.ACTION_VIEW,URI;9 startActivityit;拨打 :调用拨号程序10 Uri uri = Uri.parse"tel:xxxxxx"11 Intent it = new IntentIntent.ACTION_DIAL

3、, uri; 12 startActivityit; 13 Uri uri = Uri.parse"tel.xxxxxx"14 Intent it =new IntentIntent.ACTION_CALL,uri;15 要使用这个必须在配置文件中参加<uses-permission id="android .permission.CALL_PHONE" />发送SMS/MMS调用发送短信的程序16 Intent it = new IntentIntent.ACTION_VIEW; 17 it.putExtra"sms_body&q

4、uot;, "The SMS text" 18 it.setType"vnd.android-dir/mms-sms" 19 startActivityit; 发送短信20 Uri uri = Uri.parse"smsto:0800000123" 21 Intent it = new IntentIntent.ACTION_SENDTO, uri; 22 it.putExtra"sms_body", "The SMS text" 23 startActivityit; 发送彩信24 Uri u

5、ri = Uri.parse"content:/media/external/images/media/23" 25 Intent it = new IntentIntent.ACTION_SEND; 26 it.putExtra"sms_body", "some text" 27 it.putExtraIntent.EXTRA_STREAM, uri; 28 it.setType"image/png" 29 startActivityit;发送Email3031 Uri uri = Uri.parse"

6、mailto:xxxabc "32 Intent it = new IntentIntent.ACTION_SENDTO, uri;33 startActivityit;34 Intent it = new IntentIntent.ACTION_SEND; 35 it.putExtraIntent.EXTRA_EMAIL, "meabc " 36 it.putExtraIntent.EXTRA_TEXT, "The email body text" 37 it.setType"text/plain" 38 startAct

7、ivityIntent.createChooserit, "Choose Email Client" 39 Intent it=new IntentIntent.ACTION_SEND; 40 String tos="meabc " 41 String ccs="youabc " 42 it.putExtraIntent.EXTRA_EMAIL, tos; 43 it.putExtraIntent.EXTRA_CC, ccs; 44 it.putExtraIntent.EXTRA_TEXT, "The email body

8、text" 45 it.putExtraIntent.EXTRA_SUBJECT, "The email subject text" 46 it.setType"message/rfc822" 47 startActivityIntent.createChooserit, "Choose Email Client" 添加附件48 Intent it = new IntentIntent.ACTION_SEND; 49 it.putExtraIntent.EXTRA_SUBJECT, "The email subje

9、ct text" 50 it.putExtraIntent.EXTRA_STREAM, "file:/sdcard/mysong.mp3" 51 sendIntent.setType"audio/mp3" 52 startActivityIntent.createChooserit, "Choose Email Client"53 /发送附件54 Intent it = new IntentIntent.ACTION_SEND; 55 it.putExtraIntent.EXTRA_SUBJECT, "The em

10、ail subject text" 56 it.putExtraIntent.EXTRA_STREAM, "file:/sdcard/eoe.mp3" 57 sendIntent.setType"audio/mp3" 58 startActivityIntent.createChooserit, "Choose Email Client"播放多媒体59 60 Intent it = new IntentIntent.ACTION_VIEW;61 Uri uri = Uri.parse"file:/sdcard/so

11、ng.mp3"62 it.setDataAndTypeuri, "audio/mp3"63 startActivityit;64 Uri uri = Uri.withAppendedPathMediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1" 65 Intent it = new IntentIntent.ACTION_VIEW, uri; 66 startActivityit; Uninstall 程序67 Uri uri = Uri.fromParts"package", st

12、rPackageName, null; 68 Intent it = new IntentIntent.ACTION_DELETE, uri; 69 startActivityit;uninstall apk70 Uri uninstallUri = Uri.fromParts"package", "xxx", null;7172 returnIt = new IntentIntent.ACTION_DELETE, uninstallUri;install apk73 Intent intent = new IntentIntent.ACTION_VIE

13、W; 74 intent.setDataAndTypeUri.parse"file:/sdcard/test.apk", "application/vnd.android.package-archive" 75 76 startActivityintent; play audio77 Uri playUri = Uri.parse"file:/sdcard/download/everything.mp3"7879 returnIt = new IntentIntent.ACTION_VIEW, playUri; 80 /搜索应用81 Uri uri = Uri.parse"market:/search?q=pname:pkg_name" 82 Intent it = new IntentIntent.ACTION_VIEW, uri; 83 startActivityit; 84 /where pkg_name is the full package path for an application 8586 /显示指定应用的详细页面这个好似不支持了,找不到app_id87 Uri uri = Uri.parse"market:/details?id=app_id" 88

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论