一些在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自带的JAVA应用程序
  2. android studio 程序员有福了—从layout自动生成viewholder类
  3. [转]Android 应用程序基础(Application Fundamentals)
  4. 第一行代码笔记1
  5. 使用GDB调试Android NDK native(C/C++)程序
  6. 第一行代码:AlertDialog

随机推荐

  1. union组合结果集时的order问题
  2. sqlserver 多表关联时在where语句中慎用t
  3. 目前用到的两个分页存储过程代码
  4. 远程连接局域网内的sql server 无法连接
  5. sqlserver 通用分页存储过程
  6. 批量更新数据库所有表中字段的内容,中木
  7. Sql Server 2000删除数据库备份文件
  8. SQL小技巧 又快又简单的得到你的数据库每
  9. SQL Server 2000中的触发器使用
  10. SQLServer 管理常用SQL语句