1 Intent.ACTION_VIEW

String android.intent.action.VIEW

用于显示用户的数据。比较通用,会根据用户的数据类型打开相应的Activity。比如 tel:13400010001打开拨号程序,http://www.g.cn则会打开浏览器等。

代码1:

Uri uri = Uri.parse(“http://www.google.com”); //浏览器(网址必须带http)
//Uri uri =Uri.parse(“tel:1232333”); //拨号程序
//Uri uri=Uri.parse(“geo:39.899533,116.036476”); //打开地图定位
Intent it = new Intent(Intent.ACTION_VIEW,uri); //Intent.ACTION_VIEW不带引号
startActivity(it);

代码2:

//调用发送短信的程序
Intent it = new Intent(Intent.ACTION_VIEW);
it.putExtra(“sms_body”, “信息内容…”);
it.setType(“vnd.android-dir/mms-sms”);
startActivity(it);
代码3:

//播放视频
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.parse(“file:///sdcard/media.mp4”);
intent.setDataAndType(uri, “video/*”);
startActivity(intent);

2 Intent.ACTION_SENDTO

String: android.intent.action.SENDTO

说明:发送短信息

//发送短信息
Uri uri = Uri.parse(“smsto:13200100001”);
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
it.putExtra(“sms_body”, “信息内容…”);
startActivity(it);

//发送彩信,设备会提示选择合适的程序发送
Uri uri = Uri.parse(“content://media/external/images/media/23”); //设备中的资源(图像或其他资源)
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(“sms_body”, “内容”);
intent.putExtra(Intent.EXTRA_STREAM, uri);
intent.setType(“image/png”);
startActivity(it);

//Email
Intent intent=new Intent(Intent.ACTION_SEND);
String[] tos={“android1@163.com”};
String[] ccs={“you@yahoo.com”};
intent.putExtra(Intent.EXTRA_EMAIL, tos);
intent.putExtra(Intent.EXTRA_CC, ccs);
intent.putExtra(Intent.EXTRA_TEXT, “The email body text”);
intent.putExtra(Intent.EXTRA_SUBJECT, “The email subject text”);
intent.setType(“message/rfc822”);
startActivity(Intent.createChooser(intent, “Choose Email Client”));

Intent.ACTION_VIEW相关推荐

  1. android intent actionview,android – 检查Intent.ACTION_VIEW上的用户操作

    正如Android Developer在 Activities上所写 In other protocols (such as ACTION_MAIN or ACTION_VIEW), you may ...

  2. Intent七大属性

    一.Intent的作用是什么?    1.Intent 用于封装程序的"调用意图".两个Activity之间,可以把需要交换的数据封装成Bundle对象,然后使用Intent携带B ...

  3. Android Intent的几种用法全面总结

    Android Intent的几种用法全面总结 Intent, 用法 Intent应该算是Android中特有的东西.你可以在Intent中指定程序要执行的动作(比如:view,edit,dial), ...

  4. android action pick,Intent中各种常见的Action

    1 Intent.ACTION_MAIN String: android.intent.action.MAIN 标识 Activity 为一个程序的开始.比较常用. Input:nothing Out ...

  5. 如何在android中水平放置三张图片,Android ACTION_VIEW多张图片

    我想要显示一到三张照片.我要等到运行时才能确切知道从Internet下载了多少张照片. 我不知道如何创建一个意图来显示照片.现在,我将它们缓存在我通过执行以下操作(无错误检查)而创建的文件夹下的sdc ...

  6. android 开发 获取各种intent (图片、apk文件、excel、pdf等文件)

    public static Intent openFile(String filePath){File file = new File(filePath);if(!file.exists()) ret ...

  7. Android 通过Intent调用系统功能和Action动作和服务广播【大全】

    1.从google搜索内容 Intent intent = new Intent(); intent.setAction(Intent.ACTION_WEB_SEARCH); intent.putEx ...

  8. Android Activity和Intent机制学习笔记

    转自:http://www.cnblogs.com/feisky/archive/2010/01/16/1649081.html Activity Android中,Activity是所有程序的根本, ...

  9. Android Studio Intent使用(显式、隐式)

    https://blog.csdn.net/u012005313/article/details/47006689 使用Intent能够使程序在不同活动中跳转,意及能够使用不同界面.Intent用法分 ...

  10. android intent例程,Android开发(四)| 探究活动(详解Intent+大量实例)

    在Android的开发项目中,Activity(活动)是最容易吸引到用户的地方,因为相比于算法.架构,它是实际可见的. Activity是一个可以包含用户界面的组件,主要用于和用户进行交互.一个用户程 ...

最新文章

  1. 英语语法总结--连词
  2. 【呆鸟译Py】20个数据分析前必须搞清楚的问题
  3. 如何将本地代码上传到GitHub
  4. 机器人学习--Turtelbot3学习--如何使用cartographer建图
  5. Python3基础 if __name__ == '__main__'
  6. nodejs虚拟服务器,NodeJs本地搭建服务器,模拟接口请求,获取json数据
  7. The word is not correctly spelled问题
  8. cas 怎么过滤带pathvariable_过滤材料怎么摆?记住这个“公式”就好~
  9. 如何区分电压串联负反馈电路和电流串联负反馈电路
  10. 【Camera基础(二)】摄像头驱动原理和开发V4L2子系统驱动架构
  11. 使用js的方式设置点击按钮发送短信倒计时并且防止刷新
  12. 如何提高团队管理能力
  13. 人脸属性分析--性别、年龄和表情识别
  14. 全局地址池 与接口地址池
  15. 海思3559万能平台搭建:OSD功能的优化
  16. 计算机表格布局,什么是表格布局
  17. C++Primer第五版——习题答案+详解(完整版)
  18. Unity使用Shader实现3D模型外描边效果ObjectOutline.shader
  19. Python:突然发现好看壁纸的都在某度图片库了,这还爬什么壁纸网站?
  20. 「工具」不限速的百度网盘工具

热门文章

  1. VASP+VTST编译安装
  2. 基础训练—龟兔赛跑预测(  话说这个世界上有各种各样的兔子和乌龟,但是研究发现,所有的兔子和乌龟都有一个共同的特点——喜欢赛跑。于是世界上各个角落都不断在发生着乌龟和兔子的比赛,小华对此很感兴趣,于)
  3. CodeFroces gym 100781 A.Adjoin the Networks(贪心)
  4. 独孤求败--之--InnoDB、MyISAM索引实现过程
  5. 仿苹果 底部弹窗 选择列表
  6. python二维数组第一列_Python遍历numpy数组的实例 python中如何提取一组数据中的第一列数据...
  7. Linux系统如何隐藏一个文件?
  8. Vista和Win2008中如何卸载IE8
  9. 基于74hc573的数码管模块测试
  10. solidworks装配教程:快速给装配体添加新零件