一些在 Android中常用的 Intent启动服务,当执行startActivity时候,Android将会根据Intent绑定的信息寻找最合适的启动程序来接应,并执行程序以完成意图的实现。

打开浏览器显示网页:
  1. Uriuri = Uri.parse("http://www.ataaw.com");
  2. Intent intent = new Intent(Intent.ACTION_VIEW,uri);
  3. startActivintenty(intent);
复制代码地图参数显示地图:
  1. Uri uri = Uri.parse("geo:38.899533,-77.036476");
  2. Intent intent = new Intent(Intent.Action_VIEW,uri);
  3. startActivintenty(intent);
复制代码 拨打电话,调用拨号程序:
  1. Uri uri = Uri.parse("tel:13800138000");
  2. Intent intent = new Intent(Intent.ACTION_DIAL, uri);
  3. startActivintenty(intent);
复制代码 调用发送短信的程序发送SMS/MMS
  1. Intent intent = new Intent(Intent.ACTION_VIEW);
  2. intent.putExtra("sms_body", "ATAAW.COM");
  3. intent.setType("vnd.android-dir/mms-sms");
  4. startActivintenty(intent);
复制代码 调用短信程序发送短信
  1. Uri uri = Uri.parse("smsto:13800138000");
  2. Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
  3. intent.putExtra("sms_body", "ATAAW.COM");
  4. startActivintenty(intent);
复制代码 调用彩信服务发送彩信
  1. Uri uri = Uri.parse("content://media/external/images/media/exp");
  2. Intent intent = new Intent(Intent.ACTION_SEND);
  3. intent.putExtra("sms_body", "ATAAW.COM");
  4. intent.putExtra(Intent.EXTRA_STREAM, uri);
  5. intent.setType("image/png");
  6. startActivintenty(intent);
复制代码 启动邮件应用程序发送Email
  1. Uri uri = Uri.parse("mailto:ataaw.com@gmail.com");
  2. Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
  3. startActivintenty(intent);

  4. Intent intent = new Intent(Intent.ACTION_SEND);
  5. intent.putExtra(Intent.EXTRA_EMAIL, "android.sz@live.com");
  6. intent.putExtra(Intent.EXTRA_TEXT, "邮件内容。");
  7. intent.setType("text/plain");
  8. startActivintenty(Intent.createChooser(intent, "Choose Email Client"));

  9. Intent intent=new Intent(Intent.ACTION_SEND);
  10. String[] tos={"ataaw.com@gmail.com"};
  11. String[] ccs={"cc@ataaw.com"};
  12. intent.putExtra(Intent.EXTRA_EMAIL, tos);
  13. intent.putExtra(Intent.EXTRA_CC, ccs);
  14. intent.putExtra(Intent.EXTRA_TEXT, "邮件内容。");
  15. intent.putExtra(Intent.EXTRA_SUBJECT, "邮件主题");
  16. intent.setType("message/rfc822");
  17. startActivintenty(Intent.createChooser(intent, "Choose Email Client"));
复制代码 添加邮件附件内容
  1. Intent intent = new Intent(Intent.ACTION_SEND);
  2. intent.putExtra(Intent.EXTRA_SUBJECT, "主题");
  3. intent.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/ataaw.mp3");
  4. sendIntent.setType("audio/mp3");
  5. startActivintenty(Intent.createChooser(intent, "Choose Email Client"));
复制代码 播放mp4多媒体文件
  1. Intent intent = new Intent(Intent.ACTION_VIEW);
  2. Uri uri = Uri.parse("file:///sdcard/ataaw.mp3");
  3. intent.setDataAndType(uri, "audio/mp3");
  4. startActivintenty(intent);
复制代码

更多相关文章

  1. [转]Android(安卓)onActivityResult()不执行的几个原因
  2. Android(安卓)圆角的Button
  3. Android(安卓)6.0 使用HttpClient的问题
  4. Android之HorizontalScrollView(一)
  5. Android(安卓)draw onAttachToWindow
  6. Android练习
  7. Android四大基本组件-Service详解
  8. android异步发网络请求
  9. Android中帧动画

随机推荐

  1. Android中Service(服务)的使用
  2. Android读取手机通讯录联系人到自己项目
  3. Android内存优化总结
  4. AndroidActivity切换动画overridePending
  5. Android高级之Volley框架(一):StringRequest
  6. Android(安卓)sqlite数据库简单使用(创建
  7. android: LayoutInflater使用
  8. android 视频图片轮播
  9. Android(安卓)Studio Live Templates 详
  10. Eclipse中Android显示注释文档的办法和An