1.从google搜索内容
Intent intent = new Intent();
(Intent.ACTION_WEB_SEARCH);
(,"searchString")
startActivity(intent);
2.浏览网页
Uri uri = ("");
Intent it = new Intent(Intent.ACTION_VIEW,uri);
startActivity(it);
3.显示地图
Uri uri = ("geo:38.899533,-77.036476");
Intent it = new Intent(Intent.Action_VIEW,uri);
startActivity(it);
4.路径规划
Uri uri = ("/maps?f=dsaddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");
Intent it = new Intent(Intent.ACTION_VIEW,URI);
startActivity(it);
5.拨打电话
Uri uri = ("tel:xxxxxx");
Intent it = new Intent(Intent.ACTION_DIAL, uri);
startActivity(it);
6.调用发短信的程序
Intent it = new Intent(Intent.ACTION_VIEW);
("sms_body", "The SMS text");
("-dir/mms-sms");
startActivity(it);
7.发送短信
Uri uri = ("smsto:0800000123");
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
("sms_body", "The SMS text");
startActivity(it);
String body="this is sms demo";
Intent mmsintent = new Intent(Intent.ACTION_SENDTO, ("smsto", number, null));
(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY, body);
(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE, true);
(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT, true);
startActivity(mmsintent);
8.发送彩信
Uri uri = ("content://media/external/images/media/23");
Intent it = new Intent(Intent.ACTION_SEND);
("sms_body", "some text");
(Intent.EXTRA_STREAM, uri);
("image/png");
startActivity(it);
StringBuilder sb = new StringBuilder();
("file://");
(());
Intent intent = new Intent(Intent.ACTION_SENDTO, ("mmsto", number, null));
// Below extra datas are all optional.
(Messaging.KEY_ACTION_SENDTO_MESSAGE_SUBJECT, subject);
(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY, body);
(Messaging.KEY_ACTION_SENDTO_CONTENT_URI, ());
(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE, composeMode);
(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT, exitOnSent);
startActivity(intent);
9.发送Email
Uri uri = ("mailto:xxx@");
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
startActivity(it);
Intent it = new Intent(Intent.ACTION_SEND);
(Intent.EXTRA_EMAIL, "me@");
(Intent.EXTRA_TEXT, "The email body text");
("text/plain");
startActivity((it, "Choose Email Client"));
Intent it=new Intent(Intent.ACTION_SEND);
String[] tos={"me@"};
String[] ccs={"you@"};
(Intent.EXTRA_EMAIL, tos);
(Intent.EXTRA_CC, ccs);
(Intent.EXTRA_TEXT, "The email body text");
(Intent.EXTRA_SUBJECT, "The email subject text");
("message/rfc822");
startActivity((it, "Choose Email Client"));
Intent it = new Intent(Intent.ACTION_SEND);
(Intent.EXTRA_SUBJECT, "The email subject text");
(Intent.EXTRA_STREAM, "file:///sdcard/mysong.mp3");
("audio/mp3");
startActivity((it, "Choose Email Client"));
10.播放多媒体
Intent it = new Intent(Intent.ACTION_VIEW);
Uri uri = ("file:///sdcard/song.mp3");
(uri, "audio/mp3");
startActivity(it);
Uri uri = (.INTERNAL_CONTENT_URI, "1");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
apk
Uri uri = ("package", strPackageName, null);
Intent it = new Intent(Intent.ACTION_DELETE, uri);
startActivity(it);
apk
Uri installUri = ("package", "xxx", null);
returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
13. 打开照相机
<1>Intent i = new Intent(Intent.ACTION_CAMERA_BUTTON, null);
(i);
<2>long dateTaken = ();
String name = createName(dateTaken) + ".jpg";
fileName = folder + name;
ContentValues values = new ContentValues();
(, fileName);
("_data", fileName);
(.PICASA_ID, fileName);
(.DISPLAY_NAME, fileName);
(, fileName);
(.BUCKET_DISPLAY_NAME, fileName);
Uri photoUri = getContentResolver().insert(
.EXTERNAL_CONTENT_URI, values);
Intent inttPhoto = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
(MediaStore.EXTRA_OUTPUT, photoUri);
startActivityForResult(inttPhoto, 10);
14.从gallery选取图片
Intent i = new Intent();
("image/*");
(Intent.ACTION_GET_CONTENT);
startActivityForResult(i, 11);
15. 打开录音机
Intent mi = new Intent(Media.RECORD_SOUND_ACTION);
startActivity(mi);
16.显示应用详细列表
Uri uri = ("market://details?id=app_id");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
//where app_id is the application ID, find the ID
//by clicking on your application on Market home
//page, and notice the ID from the address bar
刚才找app id未果,结果发现用package name也可以
Uri uri = ("market://details?id=<packagename>");
这个简单多了
17寻找应用
Uri uri = ("market://search?q=pname:pkg_name");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
//where pkg_name is the full package path for an application
18打开联系人列表
<1>
Intent i = new Intent();
(Intent.ACTION_GET_CONTENT);
("/phone");
startActivityForResult(i, REQUEST_TEXT);
<2>
Uri uri = ("content://contacts/people");
Intent it = new Intent(Intent.ACTION_PICK, uri);
startActivityForResult(it, REQUEST_TEXT);
19 打开另一程序
Intent i = new Intent();
ComponentName cn = new ComponentName(".android2",
".");
(cn);
("");
startActivityForResult(i, RESULT_OK);
相关文章
- Intent.ACTION_VIEW
- Intent之Action详解
- Android Intent Action 大全
- Android——Intent.ACTION_VIEW
- Android 程序员的技术栈大全
- Android使用intent跳转到其它应用activity界面
- 【Android】6.0 添加Menu菜单组件、Intent启动活动、显式Intent、隐式Intent
- Android -- 两个activity界面的切换, 显示Intent 和 隐式Intent,putExtra传递数据
- Android开发值利用Intent进行put传值,setclass启动activity,并用get进行取值
- android学习四---Activity和Intent