



全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Intent的几种用法 博客分类: AndroidAndroidGoogleF#下面列出几种Intent的用法显示网页:1 Uri uri = Uri.parse();2 Intent it = new Intent(Intent.ACTION_VIEW,uri);3 startActivity(it);显示地图:4 Uri uri = Uri.parse(geo:38.899533,-77.036476);5 Intent it = new Intent(Intent.Action_VIEW,uri);6 startActivity(it);路径规划:7 Uri uri = Uri.parse(/maps?f=d&saddr=startLat%20startLng&daddr=endLat%20endLng&hl=en);8 Intent it = new Intent(Intent.ACTION_VIEW,URI);9 startActivity(it);拨打电话:调用拨号程序10 Uri uri = Uri.parse(tel:xxxxxx);11 Intent it = new Intent(Intent.ACTION_DIAL, uri); 12 startActivity(it); 13 Uri uri = Uri.parse(tel.xxxxxx);14 Intent it =new Intent(Intent.ACTION_CALL,uri);15 要使用这个必须在配置文件中加入发送SMS/MMS调用发送短信的程序16 Intent it = new Intent(Intent.ACTION_VIEW); 17 it.putExtra(sms_body, The SMS text); 18 it.setType(vnd.android-dir/mms-sms); 19 startActivity(it); 发送短信20 Uri uri = Uri.parse(smsto:0800000123); 21 Intent it = new Intent(Intent.ACTION_SENDTO, uri); 22 it.putExtra(sms_body, The SMS text); 23 startActivity(it); 发送彩信24 Uri uri = Uri.parse(content:/media/external/images/media/23); 25 Intent it = new Intent(Intent.ACTION_SEND); 26 it.putExtra(sms_body, some text); 27 it.putExtra(Intent.EXTRA_STREAM, uri); 28 it.setType(image/png); 29 startActivity(it);发送Email3031 Uri uri = Uri.parse(mailto:);32 Intent it = new Intent(Intent.ACTION_SENDTO, uri);33 startActivity(it);34 Intent it = new Intent(Intent.ACTION_SEND); 35 it.putExtra(Intent.EXTRA_EMAIL, ); 36 it.putExtra(Intent.EXTRA_TEXT, The email body text); 37 it.setType(text/plain); 38 startActivity(Intent.createChooser(it, Choose Email Client); 39 Intent it=new Intent(Intent.ACTION_SEND); 40 String tos=; 41 String ccs=; 42 it.putExtra(Intent.EXTRA_EMAIL, tos); 43 it.putExtra(Intent.EXTRA_CC, ccs); 44 it.putExtra(Intent.EXTRA_TEXT, The email body text); 45 it.putExtra(Intent.EXTRA_SUBJECT, The email subject text); 46 it.setType(message/rfc822); 47 startActivity(Intent.createChooser(it, Choose Email Client); 添加附件48 Intent it = new Intent(Intent.ACTION_SEND); 49 it.putExtra(Intent.EXTRA_SUBJECT, The email subject text); 50 it.putExtra(Intent.EXTRA_STREAM, file:/sdcard/mysong.mp3); 51 sendIntent.setType(audio/mp3); 52 startActivity(Intent.createChooser(it, Choose Email Client);53 /发送附件54 Intent it = new Intent(Intent.ACTION_SEND); 55 it.putExtra(Intent.EXTRA_SUBJECT, The email subject text); 56 it.putExtra(Intent.EXTRA_STREAM, file:/sdcard/eoe.mp3); 57 sendIntent.setType(audio/mp3); 58 startActivity(Intent.createChooser(it, Choose Email Client);播放多媒体59 60 Intent it = new Intent(Intent.ACTION_VIEW);61 Uri uri = Uri.parse(file:/sdcard/song.mp3);62 it.setDataAndType(uri, audio/mp3);63 startActivity(it);64 Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, 1); 65 Intent it = new Intent(Intent.ACTION_VIEW, uri); 66 startActivity(it); Uninstall 程序67 Uri uri = Uri.fromParts(package, strPackageName, null); 68 Intent it = new Intent(Intent.ACTION_DELETE, uri); 69 startActivity(it);uninstall apk70 Uri uninstallUri = Uri.fromParts(package, xxx, null);7172 returnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);install apk73 Intent intent = new Intent(Intent.ACTION_VIEW); 74 intent.setDataAndType(Uri.parse(file:/sdcard/test.apk), application/vnd.android.package-archive); 75 76 startActivity(intent); play audio77 Uri playUri = Uri.parse(file:/sdcard/download/everything.mp3);7879 returnIt = new Intent(Intent.ACTION_VIEW, playUri); 80 /搜索应用81 Uri uri = Uri.parse(market:/search?q=pname:pkg_name); 82 Intent it = new Intent(Intent.ACTION_VIEW, uri); 83 startActivity(it); 84 /where pkg_name is the full package path for an application 8586 /显示指定应用的详细页面(这个好像不支持了,找不到app_id)87 Uri uri = Uri.parse(market:/details?id=app_id); 88 Intent it = new Intent
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- GB/T 18760-2025消费品售后服务方法与要求
- 下水井维修合同范本
- 供应合同范本长期
- 2025年吐鲁番怎么考货运从业资格证
- 住宅绿化养护合同范本
- 医疗健康服务合同范本
- 个体工商退股合同范本
- 助理编辑聘约合同范本
- 苏州代建合同范本
- 公司改造施工合同范本
- QBT 2088-1995 硅藻土行业标准
- 交管12123学法减分考试题库及答案
- 数字电子技术(武汉科技大学)智慧树知到期末考试答案章节答案2024年武汉科技大学
- 《冷作工》 课件 七、扣缝制作
- 室内设计采光分析报告
- 学习解读2024年新制定的学位法课件
- 四川省高等教育自学考试自考毕业生登记表001汇编
- 运河古街项目招商规划方案
- 围手术期血糖管理指南
- 阑尾粘液性囊腺瘤影像诊断与鉴别
- 《社区康复》课件-第十章 养老社区康复实践
评论
0/150
提交评论