1.从google搜索内容
Intent intent = new Intent();
intent.setAction(Intent.ACTION_WEB_SEARCH);
intent.putExtra(SearchManager.QUERY,"searchString")
startActivity(intent);
2.浏览网页
Uri uri = Uri.parse("http://www.google.com");
Intent it = new Intent(Intent.ACTION_VIEW,uri);
startActivity(it);
3.显示地图
Uri uri = Uri.parse("geo:38.899533,-77.036476");
Intent it = new Intent(Intent.Action_VIEW,uri);
startActivity(it);
4.路径规划
Uri uri = Uri.parse("http://maps.google.com/maps?f=dsaddr=startLat startLng&daddr=endLat endLng&hl=en");
Intent it = new Intent(Intent.ACTION_VIEW,URI);
startActivity(it);
5.拨打电话
Uri uri = Uri.parse("tel:xxxxxx");
Intent it = new Intent(Intent.ACTION_DIAL, uri);
startActivity(it);
6.调用发短信的程序
Intent it = new Intent(Intent.ACTION_VIEW);
it.putExtra("sms_body", "The SMS text");
it.setType("vnd.android-dir/mms-sms");
startActivity(it);
7.发送短信
Uri uri = Uri.parse("smsto:0800000123");
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
it.putExtra("sms_body", "The SMS text");
startActivity(it);
String body="this is sms demo";
Intent mmsintent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("smsto", number, null));
mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY, body);
mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE, true);
mmsintent.putExtra(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT, true);
startActivity(mmsintent);
8.发送彩信
Uri uri = Uri.parse("content://media/external/images/media/23");
Intent it = new Intent(Intent.ACTION_SEND);
it.putExtra("sms_body", "some text");
it.putExtra(Intent.EXTRA_STREAM, uri);
it.setType("image/png");
startActivity(it);
StringBuilder sb = new StringBuilder();
sb.append("file://");
sb.append(fd.getAbsoluteFile());
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mmsto", number, null));
// Below extra datas are all optional.
intent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_SUBJECT, subject);
intent.putExtra(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY, body);
intent.putExtra(Messaging.KEY_ACTION_SENDTO_CONTENT_URI, sb.toString());
intent.putExtra(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE, composeMode);
intent.putExtra(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT, exitOnSent);
startActivity(intent);
9.发送Email
Uri uri = Uri.parse("mailto:xxx@abc.com");
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
startActivity(it);
Intent it = new Intent(Intent.ACTION_SEND);
it.putExtra(Intent.EXTRA_EMAIL, "me@abc.com");
it.putExtra(Intent.EXTRA_TEXT, "The email body text");
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={"you@abc.com"};
it.putExtra(Intent.EXTRA_EMAIL, tos);
it.putExtra(Intent.EXTRA_CC, ccs);
it.putExtra(Intent.EXTRA_TEXT, "The email body text");
it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");
it.setType("message/rfc822");
startActivity(Intent.createChooser(it, "Choose Email Client"));
Intent it = new Intent(Intent.ACTION_SEND);
it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");
it.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/mysong.mp3");
sendIntent.setType("audio/mp3");
startActivity(Intent.createChooser(it, "Choose Email Client"));
10.播放多媒体
Intent it = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.parse("file:///sdcard/song.mp3");
it.setDataAndType(uri, "audio/mp3");
startActivity(it);
Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
11.uninstall apk
Uri uri = Uri.fromParts("package", strPackageName, null);
Intent it = new Intent(Intent.ACTION_DELETE, uri);
startActivity(it);
12.install apk
Uri installUri = Uri.fromParts("package", "xxx", null);
returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
相关推荐
### Android Intent用法大全 #### 概述 在Android开发中,`Intent`是一个非常重要的概念,它主要用于组件之间的通信,比如启动一个Activity、服务、广播接收器等。本篇文章将详细介绍Intent的各种常见用法,包括但...
在Android应用开发中,Intent是连接应用程序组件之间通信的主要方式,它可以用来启动新的Activity或服务,也可以传递数据。"Intent跳转传值"是Android开发中的一个基础且重要的概念,它使得不同组件间的数据共享变得...
Intent 显示网页、拨打电话、发送SMS/MMS、播放多媒体等等,代码简洁,非常实用。
在Android开发中,Intent是一种非常重要的组件,它用于在应用程序的不同组件之间传递消息,实现活动(Activity)、服务(Service)、广播接收器(Broadcast Receiver)以及内容提供者(Content Provider)之间的交互...
在sendBroadcast,startActivity时,我们会用到Intent。 Intent可以携带一些数据,比如基本类型数据int、Boolean,或是String,或是序列化对象,Parcelable与Serializable。 Intent传递数据时,如果数据太大,可能...
根据提供的文件信息,我们可以总结出一系列关于Android应用开发中的Intent操作相关知识点。这些知识点主要涉及如何使用Intents来启动各种类型的活动(如网页浏览、地图导航、拨打电话、发送短信等)。下面将对每一个...
Android 广播大全 Intent Action 事件 Android 广播大全 Intent Action 事件是 Android 系统中的一种核心机制,用于在应用程序之间传递信息和事件通知。 Intent 是一种轻量级的消息对象,用于描述一个操作的请求或...
### Intent的常用方法 在Android开发中,`Intent`是一个非常重要的类,它主要用于应用程序组件间的通信。通过`Intent`可以启动新的Activity、Service或发送Broadcast等操作。本文将详细介绍`Intent`的一些常见用法...
在Android应用开发中,Intent是一种强大的机制,用于在组件之间进行通信。Intent不仅可以用来启动新的Activity,还可以启动服务、广播接收器等。本教程将详细讲解如何使用Intent来实现特定的功能,包括打开新的...
【Android Intent和Intent Filter详解】 Intent是Android系统中用于组件间通信的重要机制,它描述了想要执行的操作和可能涉及的数据。Intent对象包含了组件信息、动作(Action)、数据(Data)、类别(Category)...
在Android开发中,Intent是一种非常重要的组件间通信机制。它被用来启动活动(Activity)、服务(Service)或者广播接收器(Broadcast Receiver),并且可以传递数据和执行动作。本篇文章将详细解析“Intent系统调用...
【Android Intent 启动和关闭Activity】 在Android应用程序开发中,Intent是连接各个组件(如Activity、Service等)的关键桥梁,主要用于启动和关闭Activity。Intent不仅能够启动一个新的Activity,还能在Activity...
在Android开发中,Intent是一种非常重要的机制,用于在应用程序组件之间进行通信,它可以用来启动其他组件,如Activity、BroadcastReceiver和服务,或者启动系统服务。在本文中,我们将深入探讨`android_intent`和`...
在Android开发中,Intent和Intent Filters是两个至关重要的概念,它们是应用程序之间通信的主要桥梁,也是实现外部调用的关键机制。下面将详细讲解Intent和Intent Filters的工作原理以及如何使用它们来实现外部调用...
在Android开发中,Intent是一个非常核心且至关重要的组件,它扮演着应用程序内部或应用程序之间通信的桥梁角色。Intent主要用于启动活动(Activity)、服务(Service)或者广播接收器(BroadcastReceiver),并传递...
### Android Intent原理深入解析 #### 一、概览与引言 在移动开发领域,特别是在Android平台上,**Intent**作为核心通信机制之一,扮演着关键角色。它不仅用于应用程序内部不同组件之间的通信,也是实现跨应用通信...
本文将深入探讨Intent的使用方式,包括显式Intent、隐式Intent、Intent Filter、数据传递以及如何通过Intent调用系统服务和启动第三方应用。 首先,我们来了解一下**显式Intent**。显式Intent明确指定了要启动的...
在Android开发中,Intent是一种非常重要的组件间通信(IPC)机制。Intent主要用于启动或与其它应用程序组件进行交互,如活动(Activity)、服务(Service)、广播接收器(BroadcastReceiver)以及内容提供者...
在Android开发中,Intent是一种非常重要的组件,它用于在应用程序之间建立通信桥梁,实现不同组件间的交互。Intent不仅可以启动活动(Activity)、服务(Service),还能广播(Broadcast)消息。在这个文档中,我们...
在Android开发中,Intent是一种非常重要的组件,它用于在应用程序的不同组件之间传递消息,实现活动(Activity)之间的交互。Intent不仅用于启动新的Activity,还能启动服务(Service)或广播接收器...