Intent的实例用法
来源:互联网 发布:江西网络干部学院 密码 编辑:程序博客网 时间:2024/05/17 08:10
1.打开网页
Uri uri = Uri.parse("http://www.google.com.hk");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
2.打开地图
/* 必须使用Google APIs包 */
Uri uri = Uri.parse("geo:113.46,22.27");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
3.呼出电话拨号器
Uri uri = Uri.parse("tel:15013580650");
Intent intent = new Intent(Intent.ACTION_DIAL, uri);
startActivity(intent);
4.拨打电话
/* 必须加上android.permission.CALL_PHONE权限 */
Uri uri = Uri.parse("tel:15013580650");
Intent intent = new Intent(Intent.ACTION_CALL, uri);
startActivity(intent);
5.发送短信
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.putExtra("sms_body", "这里输入短信内容");
intent.setType("vnd.android-dir/mms-sms");
startActivity(intent);
6.发送短信(带号码)
Uri uri = Uri.parse("smsto:5554");
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
intent.putExtra("sms_body", "这里输入短信内容");
startActivity(intent);
7.发送彩信
// 发送彩信的图片路径
Uri uri = Uri.parse("file:///sdcard/handou.png");
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra("sms_body", "这里输入信息内容");
// 彩信附件
intent.putExtra(Intent.EXTRA_STREAM, uri);
// 文件类型
intent.setType("image/png");
startActivity(intent);
8.发送邮件
String[] tos = {"doctang@163.com"};
String[] ccs = {"tangmin@163.com"};
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, tos);
intent.putExtra(Intent.EXTRA_CC, ccs);
intent.putExtra(Intent.EXTRA_TEXT, "邮件正文");
intent.putExtra(Intent.EXTRA_SUBJECT, "邮件主题");
//intent.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/handou.png");
intent.setType("text/plain");
startActivity(intent);
Uri uri = Uri.parse("http://www.google.com.hk");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
2.打开地图
/* 必须使用Google APIs包 */
Uri uri = Uri.parse("geo:113.46,22.27");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
3.呼出电话拨号器
Uri uri = Uri.parse("tel:15013580650");
Intent intent = new Intent(Intent.ACTION_DIAL, uri);
startActivity(intent);
4.拨打电话
/* 必须加上android.permission.CALL_PHONE权限 */
Uri uri = Uri.parse("tel:15013580650");
Intent intent = new Intent(Intent.ACTION_CALL, uri);
startActivity(intent);
5.发送短信
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.putExtra("sms_body", "这里输入短信内容");
intent.setType("vnd.android-dir/mms-sms");
startActivity(intent);
6.发送短信(带号码)
Uri uri = Uri.parse("smsto:5554");
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
intent.putExtra("sms_body", "这里输入短信内容");
startActivity(intent);
7.发送彩信
// 发送彩信的图片路径
Uri uri = Uri.parse("file:///sdcard/handou.png");
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra("sms_body", "这里输入信息内容");
// 彩信附件
intent.putExtra(Intent.EXTRA_STREAM, uri);
// 文件类型
intent.setType("image/png");
startActivity(intent);
8.发送邮件
String[] tos = {"doctang@163.com"};
String[] ccs = {"tangmin@163.com"};
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, tos);
intent.putExtra(Intent.EXTRA_CC, ccs);
intent.putExtra(Intent.EXTRA_TEXT, "邮件正文");
intent.putExtra(Intent.EXTRA_SUBJECT, "邮件主题");
//intent.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/handou.png");
intent.setType("text/plain");
startActivity(intent);
- Intent的实例用法
- android的Intent用法实例
- android的Intent用法实例
- Intent用法实例
- 一些Intent用法实例
- Intent用法实例
- Intent用法实例
- Intent 用法具体实例
- 一些Intent用法实例
- Android:intent用法实例
- Intent用法实例
- intent 用法 实例
- Intent用法实例
- Intent用法实例
- Intent用法实例
- Intent用法实例
- Intent用法实例
- Intent用法实例
- Android中Service类onStartCommand的返回值问题
- ORACLE 11g 导出到 10g整理
- 企业IT投资:不要忽视核心IT能力的培育
- win32动态库
- 数据库系统预警机制
- Intent的实例用法
- Windows Phone 7 向好的一面看看
- wprintf不能在linux下输出的问题
- LIST
- HUD OJ 1232 畅通工程 和 HDU OJ 1233还是畅通工程【并查集和克鲁斯卡尔算法】
- 浏览器的标准兼容模式和怪异呈现模式以及盒模型
- 写好代码的十个要诀 -----林锐博士
- 最美是你雍容朦胧懒懒俏皮娇气不想起床的呓语
- Android PopupWindow介绍及实现菜单效果