`
itmg_lee
  • 浏览: 40218 次
  • 性别: Icon_minigender_1
  • 来自: 陕西省西安市
文章分类
社区版块
存档分类
最新评论

android intent和intent action大全

阅读更多
★intent大全:

  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%20startLng&daddr=endLat%20endLng&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);

  13. 打开照相机

  <1>Intent i = new Intent(Intent.ACTION_CAMERA_BUTTON, null);

  this.sendBroadcast(i);

  <2>long dateTaken = System.currentTimeMillis();

  String name = createName(dateTaken) + ".jpg";

  fileName = folder + name;

  ContentValues values = new ContentValues();

  values.put(Images.Media.TITLE, fileName);

  values.put("_data", fileName);

  values.put(Images.Media.PICASA_ID, fileName);

  values.put(Images.Media.DISPLAY_NAME, fileName);

  values.put(Images.Media.DESCRIPTION, fileName);

  values.put(Images.ImageColumns.BUCKET_DISPLAY_NAME, fileName);
Uri photoUri = getContentResolver().insert(

  MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);

  Intent inttPhoto = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

  inttPhoto.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);

  startActivityForResult(inttPhoto, 10);

  14.从gallery选取图片

  Intent i = new Intent();

  i.setType("image/*");

  i.setAction(Intent.ACTION_GET_CONTENT);

  startActivityForResult(i, 11);

  15. 打开录音机

  Intent mi = new Intent(Media.RECORD_SOUND_ACTION);

  startActivity(mi);

  16.显示应用详细列表

  Uri uri = Uri.parse("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 = Uri.parse("market://details?id=");

  这个简单多了

  17寻找应用

  Uri uri = Uri.parse("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();

  i.setAction(Intent.ACTION_GET_CONTENT);

  i.setType("vnd.android.cursor.item/phone");

  startActivityForResult(i, REQUEST_TEXT);

  <2>

  Uri uri = Uri.parse("content://contacts/people");

  Intent it = new Intent(Intent.ACTION_PICK, uri);

  startActivityForResult(it, REQUEST_TEXT);

  19 打开另一程序

  Intent i = new Intent();

  ComponentName cn = new ComponentName("com.yellowbook.android2",

  "com.yellowbook.android2.AndroidSearch");
i.setComponent(cn);

  i.setAction("android.intent.action.MAIN");

  startActivityForResult(i, RESULT_OK);

  ★intent action大全:

  android.intent.action.ALL_APPS

  android.intent.action.ANSWER

  android.intent.action.ATTACH_DATA

  android.intent.action.BUG_REPORT

  android.intent.action.CALL

  android.intent.action.CALL_BUTTON

  android.intent.action.CHOOSER

  android.intent.action.CREATE_LIVE_FOLDER

  android.intent.action.CREATE_SHORTCUT

  android.intent.action.DELETE

  android.intent.action.DIAL

  android.intent.action.EDIT

  android.intent.action.GET_CONTENT

  android.intent.action.INSERT

  android.intent.action.INSERT_OR_EDIT

  android.intent.action.MAIN

  android.intent.action.MEDIA_SEARCH

  android.intent.action.PICK

  android.intent.action.PICK_ACTIVITY

  android.intent.action.RINGTONE_PICKER

  android.intent.action.RUN

  android.intent.action.SEARCH

  android.intent.action.SEARCH_LONG_PRESS

  android.intent.action.SEND

  android.intent.action.SENDTO

  android.intent.action.SET_WALLPAPER

  android.intent.action.SYNC

  android.intent.action.SYSTEM_TUTORIAL

  android.intent.action.VIEW

  android.intent.action.VOICE_COMMAND

  android.intent.action.WEB_SEARCH

  android.net.wifi.PICK_WIFI_NETWORK

  android.settings.AIRPLANE_MODE_SETTINGS

  android.settings.APN_SETTINGS

  android.settings.APPLICATION_DEVELOPMENT_SETTINGS

  android.settings.APPLICATION_SETTINGS

  android.settings.BLUETOOTH_SETTINGS

  android.settings.DATA_ROAMING_SETTINGS

  android.settings.DATE_SETTINGS

  android.settings.DISPLAY_SETTINGS

  android.settings.INPUT_METHOD_SETTINGS

    android.settings.INTERNAL_STORAGE_SETTINGS

  android.settings.LOCALE_SETTINGS

  android.settings.LOCATION_SOURCE_SETTINGS

  android.settings.MANAGE_APPLICATIONS_SETTINGS

  android.settings.MEMORY_CARD_SETTINGS

  android.settings.NETWORK_OPERATOR_SETTINGS

  android.settings.QUICK_LAUNCH_SETTINGS

  android.settings.SECURITY_SETTINGS

  android.settings.SETTINGS

  android.settings.SOUND_SETTINGS

  android.settings.SYNC_SETTINGS

  android.settings.USER_DICTIONARY_SETTINGS

  android.settings.WIFI_IP_SETTINGS

  android.settings.WIFI_SETTINGS

  android.settings.WIRELESS_SETTINGS


分享到:
评论

相关推荐

    android intent和intent action大全.doc

    路径规划可以使用类似的方法,但需要构造一个包含起始和终点的URL,然后传递给`ACTION_VIEW`的Intent。 ```java Uri uri = Uri.parse(...

    android-intent-and-intent-action.zip_Android Intent_action

    android intent和intent action大全

    Android 广播大全 Intent Action 事件.

    Android 广播大全 Intent Action 事件是 Android 系统中的一种核心机制,用于在应用程序之间传递信息和事件通知。 Intent 是一种轻量级的消息对象,用于描述一个操作的请求或描述一个事件。 以下是 Android 广播...

    android.intent.action.TIME_TICK

    3. 注册IntentFilter:为IntentFilter添加对应的ACTION,如"android.intent.action.TIME_TICK"、"android.intent.action.SCREEN_ON"和"android.intent.action.BATTERY_CHANGED"。 4. 不再需要时,记得在合适的位置...

    android_intent和intent_action大全

    在Android开发中,Intent是一种非常重要的机制,用于在应用程序组件之间进行通信,它可以用来启动其他组件,如Activity、...在开发过程中,合理使用Intent和IntentAction可以极大地提高应用程序的功能性和用户体验。

    android 常用的intent action整理

    ### Android常用的Intent Action整理 ...不同的Action可以实现不同的功能,合理利用Intent Action可以使应用变得更加灵活和高效。在实际开发过程中,开发者应该根据具体需求选择合适的Action来实现所需功能。

    Android利用Intent启动和关闭Activity

    【Android Intent 启动和关闭Activity】 在Android应用程序开发中,Intent是连接各个组件(如Activity、Service等)的关键桥梁,主要用于启动和关闭Activity。Intent不仅能够启动一个新的Activity,还能在Activity...

    Android的Intent实验

    - `new Intent(context, action)`: 结合上下文和动作创建Intent。 3. **Intent的分类** - 显式Intent: 直接指定目标组件,适用于在同一应用内的组件间通信。 - 隐式Intent: 不指定目标组件,而是通过动作和数据...

    android用于打开各种文件的intent.pdf

    在上面的代码中,我们首先创建了一个 Intent 对象,并指定了动作为 "android.intent.action.VIEW",然后使用 setDataAndType 方法设置了 URI 和类型为 "application/pdf",最后使用 startActivity 方法启动该 Intent...

    Android Intent和Intent Filter详解

    【Android Intent和Intent Filter详解】 Intent是Android系统中用于组件间通信的重要机制,它描述了想要执行的操作和可能涉及的数据。Intent对象包含了组件信息、动作(Action)、数据(Data)、类别(Category)...

    Android Intent用法大全

    ### Android Intent用法大全 #### 概述 在Android开发中,`Intent`是一个非常重要的概念,它主要用于组件之间的通信,比如启动一个Activity、服务、广播接收器等。本篇文章将详细介绍Intent的各种常见用法,包括但...

    Android intent原理分析

    - **进入消息队列之前**:AMS检查Intent的有效性,如Action、Data和Category是否符合规范。 - **进入消息队列后的处理**:AMS根据Intent的属性筛选合适的Receiver,并将其加入待处理队列。 - **消息的分发过程**:...

    Android Intent切换.zip

    总结一下,"Android Intent切换.zip"包含的资料提供了关于Intent使用的实例,这对于理解和掌握Android中组件间的交互至关重要。通过研究源码,开发者可以学习到如何正确构建和使用Intent,以及如何在不同组件间传递...

    android Intent实例

    ### Android Intent 实例详解 #### 一、引言 在Android开发中,`Intent`扮演着极其重要的角色,它是应用程序内部以及不同应用程序之间通信的主要方式之一。通过`Intent`,开发者能够实现各种功能,比如打开网页、...

    android Action call 拨打电话 Intent.ACTION.CALL

    需要注意的是,从Android 10(API级别29)开始,ACTION_CALL Intent被限制在系统应用和已知可信的通话应用中使用,这意味着第三方应用通常不能直接拨打电话,除非用户明确设置该应用为默认通话应用。 在实际应用中...

    Android Intent Filter用法

    &lt;action android:name="android.intent.action.SEND"/&gt; &lt;category android:name="android.intent.category.DEFAULT"/&gt; &lt;data android:mimeType="text/plain"/&gt; &lt;/intent-filter&gt; ``` 这段代码表示该组件可以处理...

    android intent 的生命周期讲解和历程

    而隐式Intent则不指定具体组件,而是根据Intent中的Action、Data、Category等信息匹配能够处理该Intent的组件。 接下来,我们关注Intent在Activity生命周期中的作用。当一个Intent被用来启动一个新的Activity时,它...

    android用于打开各种文件的intent

    ”、“Intent it = getExcelFileIntent("/mnt/sdcard/Book1.xls")”和“Intent it = getPptFileIntent("/mnt/sdcard/download/Android_PPT.ppt");”这些代码片段展示了如何创建Intent来打开存储在系统或SD卡上的Word...

    android intent 使用总结

    Android Intent 使用总结 Android Intent 是 Android 组件之间通讯的核心机制,它负责对应用...Android Intent 是 Android 组件之间通讯的核心机制,理解 Intent 的工作机制和匹配规则是开发 Android 应用程序的关键。

    Android中intent的使用

    在Android系统中,Intent分为显式Intent和隐式Intent两种类型。 1. 显式Intent:明确指定要启动的组件(Activity、Service等)的类名。这种Intent通常用于在同一应用内部进行组件间的通信,确保消息只发送到预设的...

Global site tag (gtag.js) - Google Analytics