Uri uri= Uri.parse("http://www.iteedu.com"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it);
Uri mapUri = Uri.parse("geo:38.899533,-77.036476"); Intent it = new Intent(Intent.ACTION_VIEW, mapUri); startActivity(it);
叫出拨号程序
Uri telUri = Uri.parse("tel:100861"); Intent it = new Intent(Intent.ACTION_DIAL, telUri); startActivity(it);
直接打电话出去
Uri callUri = Uri.parse("tel:100861"); Intent it = new Intent(Intent.ACTION_CALL, callUri); startActivity(it); //用這个,要在 AndroidManifest.xml 中,加上 //<uses-permission id="android.permission.CALL_PHONE" />>
Uri uninstallUri = Uri.fromParts("package", "xxx", null); Intent it = new Intent(Intent.ACTION_DELETE, uninstallUri); startActivity(it);
Uri installUri = Uri.fromParts("package", "xxx", null); Intent it = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri); startActivity(it);
Uri playUri = Uri.parse("file:///sdcard/download/everything.mp3"); Intent it = new Intent(Intent.ACTION_VIEW, playUri); startActivity(it);
Uri emailUri = Uri.parse("mailto:me@abc.com"); Intent it = new Intent(Intent.ACTION_SENDTO, emailUri); startActivity(it);
//方法一 Intent it = new Intent(Intent.ACTION_SEND); it.putExtra(Intent.EXTRA_EMAIL, "me@abc.com"); it.putExtra(Intent.EXTRA_TEXT, "iteedu.com"); it.setType("text/plain"); startActivity(Intent.createChooser(it, "Choose Email Client")); //方法二 Intent it = new Intent(Intent.ACTION_SEND); String[] tos = { "me@abc.com" }; String[] ccs = { "me@abc.com" }; it.putExtra(Intent.EXTRA_EMAIL, tos); it.putExtra(Intent.EXTRA_CC, ccs); it.putExtra(Intent.EXTRA_TEXT, "body"); it.putExtra(Intent.EXTRA_SUBJECT, "iteedu"); it.setType("message/rfc882"); Intent.createChooser(returnIt, "Choose Email Client"); startActivity(it);
Uri smsUri = Uri.parse("tel:100861"); Intent it= new Intent(Intent.ACTION_VIEW, smsUri); it.putExtra("sms_body", "iteedu.com"); it.setType("vnd.android-dir/mms-sms"); startActivity(it);
Uri mmsUri = Uri.parse("content://media/external/images/media/23"); Intent it= new Intent(Intent.ACTION_SEND); it.putExtra("sms_body", "iteedu.com"); it.putExtra(Intent.EXTRA_STREAM, mmsUri); it.setType("image/png"); startActivity(it);