调用系统组件
2016-03-01 09:43
363 查看
//web浏览器
Uri uri= Uri.parse("http://www.baidu.com:8080/image/a.jpg");
Intent intent = new Intent(Intent.ACTION_VIEW,
uri);
startActivity(intent);
//地图(要在
Android 手机上才能测试)
Uri uri = Uri.parse("geo:38.899533,-77.036476");
Intent intent = newIntent(Intent.ACTION_VIEW,
uri);
startActivity(intent);
//路径规划
Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");
Intent it = new Intent(Intent.ACTION_VIEW,
uri);
startActivity(it);
//拨打电话-调用拨号程序
Uri uri = Uri.parse("tel:15980665805");
Intent intent = new Intent(Intent.ACTION_DIAL,
uri);
startActivity(intent);
//拨打电话-直接拨打电话 //要使用这个必须在配置文件中加入<uses-permission
android:name="android.permission.CALL_PHONE"/>
Uri uri = Uri.parse("tel:15980665805");
Intent intent = newIntent(Intent.ACTION_CALL,
uri);
startActivity(intent);
//调用发送短信程序(方法一)
Uri uri = Uri.parse("smsto:15980665805");
Intent intent = new Intent(Intent.ACTION_SENDTO,
uri);
intent.putExtra("sms_body", "The SMS text");
startActivity(intent);
//调用发送短信程序(方法二)
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.putExtra("sms_body", "The SMS text");
intent.setType("vnd.android-dir/mms-sms");
startActivity(intent);
//发送彩信
Uri uri = Uri.parse("content://media/external/images/media/23");
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra("sms_body", "some text");
intent.putExtra(Intent.EXTRA_STREAM, uri);
intent.setType("image/png");
startActivity(intent);
//发送Email(方法一)(要在
Android 手机上才能测试)
Uri uri = Uri.parse("mailto:zhangsan@gmail.com");
Intent intent = new Intent(Intent.ACTION_SENDTO,
uri);
startActivity(intent);
//发送Email(方法二)(要在
Android 手机上才能测试)
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:zhangsan@gmail.com"));
intent.putExtra(Intent.EXTRA_SUBJECT, "这是标题");
intent.putExtra(Intent.EXTRA_TEXT, "这是内容");
startActivity(intent);
//发送Email(方法三)(要在
Android 手机上才能测试)
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, "me@abc.com");
intent.putExtra(Intent.EXTRA_SUBJECT, "这是标题");
intent.putExtra(Intent.EXTRA_TEXT, "这是内容");
intent.setType("text/plain");
//选择一个邮件客户端
startActivity(Intent.createChooser(intent, "Choose Email Client"));
//发送Email(方法四)(要在
Android 手机上才能测试)
Intent intent = new Intent(Intent.ACTION_SEND);
//收件人
String[] tos = {"to1@abc.com", "to2@abc.com"};
//抄送人
String[] ccs = {"cc1@abc.com", "cc2@abc.com"};
//密送人
String[] bcc = {"bcc1@abc.com", "bcc2@abc.com"};
intent.putExtra(Intent.EXTRA_EMAIL, tos);
intent.putExtra(Intent.EXTRA_CC, ccs);
intent.putExtra(Intent.EXTRA_BCC, bcc);
intent.putExtra(Intent.EXTRA_SUBJECT, "这是标题");
intent.putExtra(Intent.EXTRA_TEXT, "这是内容");
intent.setType("message/rfc822");
startActivity(Intent.createChooser(intent, "Choose Email Client"));
//发送Email且发送附件(要在
Android 手机上才能测试)
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");
intent.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/mp3/醉红颜.mp3");
intent.setType("audio/mp3");
startActivity(Intent.createChooser(intent, "Choose Email Client"));
//播放媒体文件(android
对中文名的文件支持不好)
Intent intent = new Intent(Intent.ACTION_VIEW);
//Uri
uri = Uri.parse("file:///sdcard/zhy.mp3");
Uri uri = Uri.parse("file:///sdcard/a.mp3");
intent.setDataAndType(uri, "audio/mp3");
startActivity(intent);
Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1");
Intent intent = newIntent(Intent.ACTION_VIEW,
uri);
startActivity(intent);
//音乐选择器 //它使用了Intent.ACTION_GET_CONTENT
和 MIME 类型来查找支持 audio/* 的所有 Data Picker,允许用户选择其中之一
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("audio/*");
//Intent.createChooser:应用选择器,这个方法创建一个
ACTION_CHOOSER Intent
startActivity(Intent.createChooser(intent, "选择音乐"));
Intent intent1 = new Intent(Intent.ACTION_GET_CONTENT);
intent1.setType("audio/*");
Intent intent2 = new Intent(Intent.ACTION_CHOOSER);
intent2.putExtra(Intent.EXTRA_INTENT, intent1);
intent2.putExtra(Intent.EXTRA_TITLE, "aaaa");
startActivity(intent2);
// //设置壁纸
Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
startActivity(Intent.createChooser(intent, "设置壁纸"));
//卸载APK //fromParts方法 //参数1:URI
的 scheme //参数2:包路径 //参数3:
Uri uri = Uri.fromParts("package", "com.great.activity_intent", null);
Intent intent = new Intent(Intent.ACTION_DELETE,
uri);
startActivity(intent);
//安装APK(???)
Uri uri = Uri.fromParts("package", "com.great.activity_intent", null);
Intent intent = new Intent(Intent.ACTION_PACKAGE_ADDED,
uri);
startActivity(intent);
//调用搜索
Intent intent = new Intent();
intent.setAction(Intent.ACTION_WEB_SEARCH);
intent.putExtra(SearchManager.QUERY, "android");
startActivity(intent);
Uri uri= Uri.parse("http://www.baidu.com:8080/image/a.jpg");
Intent intent = new Intent(Intent.ACTION_VIEW,
uri);
startActivity(intent);
//地图(要在
Android 手机上才能测试)
Uri uri = Uri.parse("geo:38.899533,-77.036476");
Intent intent = newIntent(Intent.ACTION_VIEW,
uri);
startActivity(intent);
//路径规划
Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");
Intent it = new Intent(Intent.ACTION_VIEW,
uri);
startActivity(it);
//拨打电话-调用拨号程序
Uri uri = Uri.parse("tel:15980665805");
Intent intent = new Intent(Intent.ACTION_DIAL,
uri);
startActivity(intent);
//拨打电话-直接拨打电话 //要使用这个必须在配置文件中加入<uses-permission
android:name="android.permission.CALL_PHONE"/>
Uri uri = Uri.parse("tel:15980665805");
Intent intent = newIntent(Intent.ACTION_CALL,
uri);
startActivity(intent);
//调用发送短信程序(方法一)
Uri uri = Uri.parse("smsto:15980665805");
Intent intent = new Intent(Intent.ACTION_SENDTO,
uri);
intent.putExtra("sms_body", "The SMS text");
startActivity(intent);
//调用发送短信程序(方法二)
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.putExtra("sms_body", "The SMS text");
intent.setType("vnd.android-dir/mms-sms");
startActivity(intent);
//发送彩信
Uri uri = Uri.parse("content://media/external/images/media/23");
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra("sms_body", "some text");
intent.putExtra(Intent.EXTRA_STREAM, uri);
intent.setType("image/png");
startActivity(intent);
//发送Email(方法一)(要在
Android 手机上才能测试)
Uri uri = Uri.parse("mailto:zhangsan@gmail.com");
Intent intent = new Intent(Intent.ACTION_SENDTO,
uri);
startActivity(intent);
//发送Email(方法二)(要在
Android 手机上才能测试)
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:zhangsan@gmail.com"));
intent.putExtra(Intent.EXTRA_SUBJECT, "这是标题");
intent.putExtra(Intent.EXTRA_TEXT, "这是内容");
startActivity(intent);
//发送Email(方法三)(要在
Android 手机上才能测试)
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, "me@abc.com");
intent.putExtra(Intent.EXTRA_SUBJECT, "这是标题");
intent.putExtra(Intent.EXTRA_TEXT, "这是内容");
intent.setType("text/plain");
//选择一个邮件客户端
startActivity(Intent.createChooser(intent, "Choose Email Client"));
//发送Email(方法四)(要在
Android 手机上才能测试)
Intent intent = new Intent(Intent.ACTION_SEND);
//收件人
String[] tos = {"to1@abc.com", "to2@abc.com"};
//抄送人
String[] ccs = {"cc1@abc.com", "cc2@abc.com"};
//密送人
String[] bcc = {"bcc1@abc.com", "bcc2@abc.com"};
intent.putExtra(Intent.EXTRA_EMAIL, tos);
intent.putExtra(Intent.EXTRA_CC, ccs);
intent.putExtra(Intent.EXTRA_BCC, bcc);
intent.putExtra(Intent.EXTRA_SUBJECT, "这是标题");
intent.putExtra(Intent.EXTRA_TEXT, "这是内容");
intent.setType("message/rfc822");
startActivity(Intent.createChooser(intent, "Choose Email Client"));
//发送Email且发送附件(要在
Android 手机上才能测试)
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");
intent.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/mp3/醉红颜.mp3");
intent.setType("audio/mp3");
startActivity(Intent.createChooser(intent, "Choose Email Client"));
//播放媒体文件(android
对中文名的文件支持不好)
Intent intent = new Intent(Intent.ACTION_VIEW);
//Uri
uri = Uri.parse("file:///sdcard/zhy.mp3");
Uri uri = Uri.parse("file:///sdcard/a.mp3");
intent.setDataAndType(uri, "audio/mp3");
startActivity(intent);
Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1");
Intent intent = newIntent(Intent.ACTION_VIEW,
uri);
startActivity(intent);
//音乐选择器 //它使用了Intent.ACTION_GET_CONTENT
和 MIME 类型来查找支持 audio/* 的所有 Data Picker,允许用户选择其中之一
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("audio/*");
//Intent.createChooser:应用选择器,这个方法创建一个
ACTION_CHOOSER Intent
startActivity(Intent.createChooser(intent, "选择音乐"));
Intent intent1 = new Intent(Intent.ACTION_GET_CONTENT);
intent1.setType("audio/*");
Intent intent2 = new Intent(Intent.ACTION_CHOOSER);
intent2.putExtra(Intent.EXTRA_INTENT, intent1);
intent2.putExtra(Intent.EXTRA_TITLE, "aaaa");
startActivity(intent2);
// //设置壁纸
Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
startActivity(Intent.createChooser(intent, "设置壁纸"));
//卸载APK //fromParts方法 //参数1:URI
的 scheme //参数2:包路径 //参数3:
Uri uri = Uri.fromParts("package", "com.great.activity_intent", null);
Intent intent = new Intent(Intent.ACTION_DELETE,
uri);
startActivity(intent);
//安装APK(???)
Uri uri = Uri.fromParts("package", "com.great.activity_intent", null);
Intent intent = new Intent(Intent.ACTION_PACKAGE_ADDED,
uri);
startActivity(intent);
//调用搜索
Intent intent = new Intent();
intent.setAction(Intent.ACTION_WEB_SEARCH);
intent.putExtra(SearchManager.QUERY, "android");
startActivity(intent);
相关文章推荐
- php的大小写敏感问题整理
- IOS多个UIImageView加载高清大图时内存管理
- PCI驱动程序实现
- 积跬步至千里系列之十二--init进程
- ViewPager1
- push xib 建的controller
- 新手在服务器上用IIS部署网站(建站)教程
- 第一次c++上机报告
- [转]❲阮一峰❳Linux 守护进程的启动方法
- JAVA学习笔记(二):eclipse智能提示(转)
- PHP 文件操作代码
- socket调试工具
- Junit单元测试框架详解
- WWDC2015
- 【代码笔记】仿QQ空间,歌曲播放
- MyEclipse内存溢出问题解决方法
- CentOS 开发环境搭建
- AngularJS基础---模块
- elasticsearch2.2的单机安装
- android 图片处理