1. Uri uri = Uri.parse("http://www.google.com");
  2. Intent it = new Intent(Intent.ACTION_VIEW,uri);
  3. startActivity(it);

显示地图:
  1. Uri uri = Uri.parse("geo:38.899533,-77.036476");
  2. Intent it = new Intent(Intent.Action_VIEW,uri);
  3. startActivity(it);

路径规划:
  1. Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");
  2. Intent it = new Intent(Intent.ACTION_VIEW,URI);
  3. startActivity(it);

拨打电话:
调用拨号程序
  1. Uri uri = Uri.parse("tel:xxxxxx");
  2. Intent it = new Intent(Intent.ACTION_DIAL, uri);  
  3. startActivity(it);  
  1. Uri uri = Uri.parse("tel.xxxxxx");
  2. Intent it =new Intent(Intent.ACTION_CALL,uri);
  3. 要使用这个必须在配置文件中加入<uses-permission id="Android.permission.CALL_PHONE" />

发送SMS/MMS
调用发送短信的程序
  1. Intent it = new Intent(Intent.ACTION_VIEW);
  2. it.putExtra("sms_body", "The SMS text");
  3. it.setType("vnd.android-dir/mms-sms");
  4. startActivity(it);  
发送短信
  1. Uri uri = Uri.parse("smsto:0800000123");
  2. Intent it = new Intent(Intent.ACTION_SENDTO, uri);
  3. it.putExtra("sms_body", "The SMS text");
  4. startActivity(it);  
发送彩信
  1. Uri uri = Uri.parse("content://media/external/images/media/23");
  2. Intent it = new Intent(Intent.ACTION_SEND);
  3. it.putExtra("sms_body", "some text");
  4. it.putExtra(Intent.EXTRA_STREAM, uri);
  5. it.setType("image/png");
  6. startActivity(it);

发送Email
  1.
  2. Uri uri = Uri.parse("mailto:xxx@abc.com");
  3. Intent it = new Intent(Intent.ACTION_SENDTO, uri);
  4. startActivity(it);
  1. Intent it = new Intent(Intent.ACTION_SEND);
  2. it.putExtra(Intent.EXTRA_EMAIL, "me@abc.com");
  3. it.putExtra(Intent.EXTRA_TEXT, "The email body text");
  4. it.setType("text/plain");
  5. startActivity(Intent.createChooser(it, "Choose Email Client"));  
  1. Intent it=new Intent(Intent.ACTION_SEND);  
  2. String[] tos={"me@abc.com"};  
  3. String[] ccs={"you@abc.com"};  
  4. it.putExtra(Intent.EXTRA_EMAIL, tos);  
  5. it.putExtra(Intent.EXTRA_CC, ccs);  
  6. it.putExtra(Intent.EXTRA_TEXT, "The email body text");  
  7. it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");  
  8. it.setType("message/rfc822");  
  9. startActivity(Intent.createChooser(it, "Choose Email Client"));

添加附件
  1. Intent it = new Intent(Intent.ACTION_SEND);
  2. it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");
  3. it.putExtra(Intent.EXTRA_STREAM, "[url=]file:///sdcard/mysong.mp3[/url]");
  4. sendIntent.setType("audio/mp3");
  5. startActivity(Intent.createChooser(it, "Choose Email Client"));

播放多媒体
  1.  
  2. Intent it = new Intent(Intent.ACTION_VIEW);
  3. Uri uri = Uri.parse("[url=]file:///sdcard/song.mp3[/url]");
  4. it.setDataAndType(uri, "audio/mp3");
  5. startActivity(it);
  1. Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1");
  2. Intent it = new Intent(Intent.ACTION_VIEW, uri);
  3. startActivity(it);

Uninstall 程序
  1. Uri uri = Uri.fromParts("package", strPackageName, null);
  2. Intent it = new Intent(Intent.ACTION_DELETE, uri);
  3. startActivity(it);

//调用相册
public static final String MIME_TYPE_IMAGE_JPEG = "image/*";
public static final int ACTIVITY_GET_IMAGE = 0;
Intent getImage = new Intent(Intent.ACTION_GET_CONTENT);
getImage.addCategory(Intent.CATEGORY_OPENABLE);
getImage.setType(MIME_TYPE_IMAGE_JPEG);
startActivityForResult(getImage, ACTIVITY_GET_IMAGE);

//调用系统相机应用程序,并存储拍下来的照片
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
time = Calendar.getInstance().getTimeInMillis();
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(Environment
.getExternalStorageDirectory().getAbsolutePath()+"/tucue", time + ".jpg")));
startActivityForResult(intent, ACTIVITY_GET_CAMERA_IMAGE);

uninstall apk
/**未测试
Uri uninstallUri = Uri.fromParts("package", "xxx", null);
returnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);
*/
Uri packageURI = Uri.parse("package:"+wistatmap);  
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);  
startActivity(uninstallIntent);

install apk
Uri installUri = Uri.fromParts("package", "xxx", null);
returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
play audio
Uri playUri = Uri.parse("[url=]file:///sdcard/download/everything.mp3[/url]");
returnIt = new Intent(Intent.ACTION_VIEW, playUri);

//发送附件
Intent it = new Intent(Intent.ACTION_SEND);  
it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");  
it.putExtra(Intent.EXTRA_STREAM, "[url=]file:///sdcard/eoe.mp3[/url]");  
sendIntent.setType("audio/mp3");  
startActivity(Intent.createChooser(it, "Choose Email Client"));

//搜索应用
Uri uri = Uri.parse("market://search?q=pname:pkg_name");  
Intent it = new Intent(Intent.ACTION_VIEW, uri);  
startActivity(it);  
//where pkg_name is the full package path for an application

//进入联系人页面
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(People.CONTENT_URI);
startActivity(intent);

//查看指定联系人
Uri personUri = ContentUris.withAppendedId(People.CONTENT_URI, info.id);//info.id联系人ID
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(personUri);
startActivity(intent);

转载于:https://www.cnblogs.com/tqj-zyy/archive/2011/11/04/2235680.html

[android笔记]常用的Uri例子相关推荐

  1. Android学习笔记-常用的一些源码,防止忘记了

    Android学习笔记-常用的一些源码,防止忘记了... 设置拨打电话 StringdialUri="tell:"+m_currentTelNumble; IntentcallIn ...

  2. Android笔记一.深入理解Intent和IntentFilters(一)

    深入理解Intent和IntentFiler(一) 转载请表明出处:http://blog.csdn.net/u012637501(嵌入式_小J的天空)     为了比較深刻的理解并灵活使用Inten ...

  3. Android 笔记之 R 文件

    Android笔记之R文件 阅读目录 介绍 R 文件的内容 介绍 通过 R 文件引用资源 一.R 文件的内容 在 Android Studio 中 R 文件位于 app -> build -&g ...

  4. androidstudio mac mini_GitHub - jp1017/AndroidStudioPlugins: Android Studio 常用插件及浅释

    AndroidStudioPlugins Android Studio 常用插件及浅释 这里给出几个平时常用的as插件,方便我们的开发.点击标题就直接可以进入插件的github源码查看. as第一大插 ...

  5. Python学习笔记:常用内建模块7XML

    前言 最近在学习深度学习,已经跑出了几个模型,但Pyhton的基础不够扎实,因此,开始补习Python了,大家都推荐廖雪峰的课程,因此,开始了学习,但光学有没有用,还要和大家讨论一下,因此,写下这些帖 ...

  6. java中链式调用_Java及Android中常用链式调用写法简单示例

    本文实例讲述了Java及Android中常用链式调用写法.分享给大家供大家参考,具体如下: 最近发现,目前大火的许多开源框架中,大多都使用了一种"(方法).(方法).(方法)"的形 ...

  7. java调用android_Java及Android中常用链式调用写法简单示例

    本文实例讲述了Java及Android中常用链式调用写法.分享给大家供大家参考,具体如下: 最近发现,目前大火的许多开源框架中,大多都使用了一种"(方法).(方法).(方法)"的形 ...

  8. Android 系统(78)---《android framework常用api源码分析》之 app应用安装流程

    <android framework常用api源码分析>之 app应用安装流程 <android framework常用api源码分析>android生态在中国已经发展非常庞大 ...

  9. Android studio 常用的插件

    Android studio 常用的插件 Exynap Effortless Android Development [官网地址]( http://exynap.com/) ![Effortless ...

最新文章

  1. 平面广告设计和Web设计的差别
  2. 利用 GPU 加速人工智能:新型计算模式
  3. Java I/O流InputStream,OutputStream,Reader,Writer
  4. java css网页布局实例_java代码例子
  5. 扫地机器人单扫和双扫_评测 | 千元以下的扫拖一体机器人,到底值不值得买?...
  6. 8-16 常见开发运维问题
  7. python基础教程是什么-Python基础教程_Python入门知识
  8. PXE+kickstart——实现网络批量装机
  9. Web前端笔记和简历模板
  10. VS2017编译Detours1.5
  11. QT5编译android安卓程序的sdk安装问题 android sdk manager
  12. 初识主成分分析 (PCA)
  13. Cesium+百度街景浏览
  14. 如何将ppt批量转换成pdf?
  15. 使用cmd注销用户、注销当前用户
  16. 霍夫变换到广义霍夫变换
  17. oracle问题诊断,Oracle之常见问题诊断方法
  18. 年报解读 | 平安银行离零售龙头还有多远?
  19. 国外优秀的域名注册商介绍
  20. 第八章 可扩展标记语言XML

热门文章

  1. easyExcel 读取数据为空的一次报错记录
  2. 日常生活小技巧 -- UART 回环测试
  3. 复习1 - String,StringBuilder,StringBuffer的执行效率区别
  4. hsf 架构_java分布服务:我打赌,没人可以这么精短的讲出分布服务架构吧
  5. JZOJ 3742. 【TJOI2014】上升子序列
  6. 简述osi参考模型各层主要功能_计软考研双日练 | OSI参考模型各层提供什么服务?...
  7. C#Socket开发TCP详解(二)
  8. 算法解读 ---- 递归(一)
  9. 关闭计算机网络端口,怎么关闭135和500端口?
  10. 新建centos6虚拟机黑屏_虚拟机centos无法进去选择系统界面,也就是开机过bios就黑屏解决方案...