隐式调用 Intent 大全, 很全

http://ming-fanglin.iteye.com/blog/1061312

//调用浏览器

  1. Uri uri = Uri.parse("");
  2. Intent it  = new Intent(Intent.ACTION_VIEW,uri);
  3. startActivity(it);

//显示某个坐标在地图上

  1. Uri uri = Uri.parse("geo:38.899533,-77.036476");
  2. Intent it = new Intent(Intent.Action_VIEW,uri);
  3. startActivity(it);

//显示路径

  1. Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");
  2. Intent it = new Intent(Intent.ACTION_VIEW,URI);
  3. startActivity(it);

//拨打电话

  1. Uri uri = Uri.parse("tel:10086");
  2. Intent it = new Intent(Intent.ACTION_DIAL, uri);
  3. startActivity(it);
  4. Uri uri = Uri.parse("tel.10086");
  5. Intent it =new Intent(Intent.ACTION_CALL,uri);
  6. 需要添加 <uses-permission id="android.permission.CALL_PHONE" /> 这个权限到androidmanifest.xml

//发送短信或彩信

  1. Intent it = new Intent(Intent.ACTION_VIEW);
  2. it.putExtra("sms_body", "The SMS text");
  3. it.setType("vnd.android-dir/mms-sms");
  4. startActivity(it);

//发送短信

  1. Uri uri = Uri.parse("smsto:10086");
  2. Intent it = new Intent(Intent.ACTION_SENDTO, uri);
  3. it.putExtra("sms_body", "cwj");
  4. startActivity(it);

//发送彩信

  1. Uri uri = Uri.parse("content://media/external/images/media/23");
  2. Intent it = new Intent(Intent.ACTION_SEND);
  3. it.putExtra("sms_body", "some text");
  4. it.putExtra(Intent.EXTRA_STREAM, uri);
  5. it.setType("image/png");
  6. startActivity(it);

//发送邮件

  1. Uri uri = Uri.parse("mailto:android123@163.com");
  2. Intent it = new Intent(Intent.ACTION_SENDTO, uri);
  3. startActivity(it);
  4. Intent it = new Intent(Intent.ACTION_SEND);
  5. it.putExtra(Intent.EXTRA_EMAIL, android123@163.com);
  6. it.putExtra(Intent.EXTRA_TEXT, "The email body text");
  7. it.setType("text/plain");
  8. startActivity(Intent.createChooser(it, "Choose Email Client"));
  9. Intent it=new Intent(Intent.ACTION_SEND);
  10. String[] tos={"me@abc.com"};
  11. String[] ccs={"you@abc.com"};
  12. it.putExtra(Intent.EXTRA_EMAIL, tos);
  13. it.putExtra(Intent.EXTRA_CC, ccs);
  14. it.putExtra(Intent.EXTRA_TEXT, "The email body text");
  15. it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");
  16. it.setType("message/rfc822");
  17. startActivity(Intent.createChooser(it, "Choose Email Client"));

//播放媒体文件

  1. Intent it = new Intent(Intent.ACTION_VIEW);
  2. Uri uri = Uri.parse("file:///sdcard/cwj.mp3");
  3. it.setDataAndType(uri, "audio/mp3");
  4. startActivity(it);
  5. Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1");
  6. Intent it = new Intent(Intent.ACTION_VIEW, uri);
  7. startActivity(it);

//卸载APK

  1. Uri uri = Uri.fromParts("package", strPackageName, null);
  2. Intent it = new Intent(Intent.ACTION_DELETE, uri);
  3. startActivity(it);

//卸载apk 2

  1. Uri uninstallUri = Uri.fromParts("package", "xxx", null);
  2. returnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);

//安装APK

  1. Uri installUri = Uri.fromParts("package", "xxx", null);
  2. returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);

//使用系统相机

  1. Intent intent = new Intent("android.media.action,IMAGE_CAPTURE");
  2. startActivity(intent);

//播放音乐

  1. Uri playUri = Uri.parse("file:///sdcard/download/sth.mp3");
  2. returnIt = new Intent(Intent.ACTION_VIEW, playUri);

//发送附近

  1. Intent it = new Intent(Intent.ACTION_SEND);
  2. it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");
  3. it.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/cwj.mp3");
  4. sendIntent.setType("audio/mp3");
  5. startActivity(Intent.createChooser(it, "Choose Email Client"));

//market上某个应用信,pkg_name就是应用的packageName

  1. Uri uri = Uri.parse("market://search?q=pname:pkg_name");
  2. Intent it = new Intent(Intent.ACTION_VIEW, uri);
  3. startActivity(it);

//market上某个应用信息,app_id可以通过www网站看下

  1. Uri uri = Uri.parse("market://details?id=app_id");
  2. Intent it = new Intent(Intent.ACTION_VIEW, uri);
  3. startActivity(it);

//调用搜索

    1. Intent intent = new Intent();
    2. intent.setAction(Intent.ACTION_WEB_SEARCH);
    3. intent.putExtra(SearchManager.QUERY,"android123")
    4. startActivity(intent);
上一篇:JS中showModalDialog 详细使用


下一篇:python开发遇到的坑(1)xpath解析ValueError: Unicode strings with encoding declaration are not supported