Android的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 = new Intent(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 = new Intent(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 = new Intent(Intent.ACTION_VIEW);
it.putExtra(“sms_body”, “The SMS text”);
it.setType(“vnd.android-dir/mms-sms”);
startActivity(it);
7.发送短信
Uri uri = Uri.parse(“smsto:0800000123”);
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
it.putExtra(“sms_body”, “The SMS text”);
startActivity(it);
String body=”this is sms demo”;
Intent mmsintent = new Intent(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 = new Intent(Intent.ACTION_SEND);
it.putExtra(“sms_body”, “some text”);
it.putExtra(Intent.EXTRA_STREAM, uri);
it.setType(“image/png”);
startActivity(it);
StringBuilder sb = new StringBuilder();
sb.append(“file://”);
sb.append(fd.getAbsoluteFile());
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(“mmsto”, number, null));
// Below extra datas are all optional.
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 = new Intent(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, “The email body text”);
it.setType(“text/plain”);
startActivity(Intent.createChooser(it, “Choose Email 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, “The email body text”);
it.putExtra(Intent.EXTRA_SUBJECT, “The email subject text”);
it.setType(“message/rfc822”);
startActivity(Intent.createChooser(it, “Choose Email Client”));
Intent it = new Intent(Intent.ACTION_SEND);
it.putExtra(Intent.EXTRA_SUBJECT, “The email 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 = new Intent(Intent.ACTION_DELETE, uri);
startActivity(it);
12.install apk
Uri installUri = Uri.fromParts(“package”, “xxx”, null);
returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
- 打开照相机
<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);
- 打开录音机
Intent mi = new Intent(Media.RECORD_SOUND_ACTION);
startActivity(mi);
16.显示应用详细列表
Uri uri = Uri.parse(“market://details?id=app_id”);
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
//where app_id is the application ID, find the ID
//by clicking on your application on Market home
//page, and notice the ID from the address bar
刚才找app id未果,结果发现用package name也可以
Uri uri = Uri.parse(“market://details?id=”);
这个简单多了
17.寻找应用
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
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 = new ComponentName(“com.yellowbook.android2”,
“com.yellowbook.android2.AndroidSearch”);
i.setComponent(cn);
i.setAction(“android.intent.action.MAIN”);
startActivityForResult(i, RESULT_OK);
Android的Intent系统调用相关推荐
- android intent email,Android Email Intent
问题 I've set up two buttons. One opens the compose sms intent and the other opens the compose email i ...
- Android中Intent传递对象的两种方法(Serializable,Parcelable)
这篇文章转自博客园 Android中Intent中如何传递对象,就我目前所知道的有两种方法,一种是Bundle.putSerializable(Key,Object);另一种是Bundle.putPa ...
- 安卓开发之Intent系统调用系统相机Camera(中软杯项目)
文章目录 出现了FileUriExposedException 原因: 出现了动态权限问题 原因: 动态申请权限博客 解决了权限问题,但是拍照没法显示于imageview 原因 误点拍照后返回程序崩溃 ...
- 3.1 Android组件intent filter
3.1.0 Intent filter基本概念 前面章节我们说到了Intent,Intent对象中除了ComponentName可以直接指定目标组件外,其它的属性都无法直接指定目标组件.当然我们这里不 ...
- 【Android】 Intent应用详解
转载:http://blog.csdn.net/liuhe688/article/details/7162988 看似尋常最奇崛,成如容易卻艱辛.北宋.王安石 看似普通的事情其实最不同寻常,并不是简简 ...
- Android的Intent Action 大全
为什么80%的码农都做不了架构师?>>> 1.Intent的用法: (1)Action跳转 1. 使用Action跳转,当程序AndroidManifest.xml中某一个 A ...
- Android中Intent传递Object和ArrayListObject对象---笔记
首先看一下Intent的官方的API. 传递一些基本类型数据的方法如下: putExtra(String name, int value) putExtra(String name, String v ...
- Android的intent之间复杂参数的传递
2019独角兽企业重金招聘Python工程师标准>>> Intent是Activity与Activity之间,Activity与Service之间传递参数的介质 Intent传递的参 ...
- android intent拍照,Android通过Intent方式调用相机拍照取得图片
Android通过Intent方式调用相机拍照取得图片 AndroidManifest.XML 权限设置: XML布局设置: 代码: public classMainActivityextendsAp ...
- Android之Intent传递数据
1.Android中的Intent对象中包含了多个putXXX()方法(如putExtra()方法)用来插入不同类型的额外数据,也包含了多个getXXX()方法(如getStringExtra().g ...
最新文章
- 云端应用SQL注入攻击
- 让PyTorch更轻便,这款深度学习框架你值得拥有!在GitHub上斩获6.6k星
- Linux: I/O多路转接之epoll(有图有代码有真相!!!)
- Nginx 状态监控、缓存的两种机制(学习笔记十四)
- 操作系统宕机,MySQL数据找回记录
- java偏向锁_Java锁事之偏向锁
- WinSock IO模型五: 完成端口
- 曲苑杂坛--即时文件初始化特性
- php datedif,Datedif函数全面解析及BUG分析
- va start linux头文件,va_start/va_end函数-linux
- 教养,就是要让别人舒服
- FrameGraph Extensible Rendering Architecture in Frostbite
- 狗狗图片识别分类的CNN(卷积网络)实现
- 【树链剖分】【模板】树的统计(P2590)
- 止盈快回撤小但容易错过行情,怎样处理才能恰到好处?
- SDNU 1270.超超的难题
- 爱站网关键词挖掘工具-长尾关键词挖掘站长工具
- 最完整Android Studio插件整理
- 英语单词----分类记
- 数据库课程设计-图书馆管理系统(1.数据库分析部分)
热门文章
- HDU - 4704(费马小定理和快速幂)
- 积温空间分布数据、气温分布数据、日照数据、降雨量分布、太阳辐射数据、地表径流数据、土地利用数据、npp数据、ndvi数据
- scala中class,object,trait的区别
- TexturePacker 图片打包工具讲解与使用并且批处理打多包以及资源加密
- python怎么用numpy_Python:一篇文章掌握Numpy的基本用法
- oracle执行计划更新,请教update和delete的执行计划
- 区块如何防篡改_CFCA联盟链荣获“2020区块链技术与应用创新成果”奖
- 几点减几点怎么列算式_结婚邀请函怎么写样板 结婚邀请函有哪几点是必写的...
- 日历小程序C语言,微信小程序实现日历功能
- mysql的db.opt文件_MySQL数据库的db.opt文件