一、显式intent如下:
(1)在intent构造函数传入两个activity文件名
Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
startActivity(intent);
(2)记得在AndroidManifest.xml中为SecondActivity进行注册
<activity android:name="SecondActivity" >
</activity>

二、隐式intent如下:
(1) 直接传action的字符串
Intent intent = new Intent("com.example.intentdemo.ACTION_START");
startActivity(intent);
(2) 记得在AndroidManifest.xml里注册。
每个 Intent 中只能指定一个 action,但却能指定多个 category。
<activity android:name=".SecondActivity" >
   <intent-filter>
         <action android:name="com.example.intentdemo.ACTION_START" />
         <category android:name="android.intent.category.DEFAULT" />
   </intent-filter>
</activity>

三.打开一个网页
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.baidu.com"));
startActivity(intent);

四.调用系统拨号界面
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:10086"));
startActivity(intent);

五.向下一个活动传递数据
Intent intent=new Intent(FirstActivity.this,SecondActivity.class);
intent.putExtra("extra_data", "Hello,SecondActivity");
startActivity(intent);

Android笔记:intent的更多相关文章

  1. Android 笔记 Intent and Bundle day7

    学习了Intent与Bundle的使用,进行应用中的交互 package com.example.intent; import android.app.Activity; import android ...

  2. Android笔记---Intent实现Activity跳转

    学了之前的Android控件以及布局,我们就能够做一些UI的设计了,这里我结合之前的知识.以一个小的登录项目来解说下Activity之间跳转. 先看下效果图: 1.登录界面: 2.点击登录按钮跳转到另 ...

  3. [转]android笔记--Intent和IntentFilter详解

    Intent用于启动Activity, Service, 以及BroadcastReceiver三种组件, 同时还是组件之间通信的重要媒介. 使用Intent启动组件的优势1, Intent为组件的启 ...

  4. android笔记--Intent和IntentFilter详解

    本文转载自:https://www.cnblogs.com/liushengjie/archive/2012/08/30/2663066.html 本文转载自:https://www.cnblogs. ...

  5. Android学习笔记-Intent(一)

    Intent对象在Android官方API这样描述:It is a passive data structure holding an abstract description of an opera ...

  6. Android笔记一.深入理解Intent和IntentFilters(一)

    深入理解Intent和IntentFiler(一) 转载请表明出处:http://blog.csdn.net/u012637501(嵌入式_小J的天空)     为了比較深刻的理解并灵活使用Inten ...

  7. Android开发学习笔记Intent 一

    Inten的概念 1.Intent是Android四大组件直接沟通的桥梁 2.Intent是一种运行时绑定(runtime binding)机制 Intent对象的属性 Itent的种类 Inten过 ...

  8. 【Android开发精要笔记】Android的Intent机制

    Android的Intent机制 Intent对象的作用和构成 android意图机制最核心的设计思想,就是引入了组件管理服务作为连接组件的管理者. 该服务的作用: 通过组件的配置信息了解系统中每个组 ...

  9. Android笔记(七十四) 详解Intent

    我们最常使用Intent来实现Activity之间的转跳,最近做一个app用到从系统搜索图片的功能,使用到了intent的 setType 方法和 setAction 方法,网上搜索一番,发现实现转跳 ...

  10. Android笔记(三) 使得Activity之间可以跳转---Intent

    什么是Intent 一个APP肯定不单单由一个Activity构成,我们在使用过程中,经常需要在多个Activity中跳转,Android中Intent可以帮我们来完成在各个Activity中跳转的功 ...

随机推荐

  1. zookeeper(2) zookeeper的核心原理

    zookeeper 的前世今生 分布式系统的很多难题,都是由于缺少协调机制造成的.在分布式协调这块做得比较好的,有 Google 的 Chubby 以及 Apache 的 Zookeeper. Goo ...

  2. kubernetes安装过程报错及解决方法

    1.your configuration file uses an old API spec: "kubeadm.k8s.io/v1alpha2". 执行kubeadm init ...

  3. window.location.search的用法 和 地址栏的的javsscript编码与解码

    ocation.search是从当前URL的?号开始的字符串 如:http://www.51js.com/viewthread.php?tid=22720 它的search就是?tid=22720 e ...

  4. Swoole 进程管理

    用法: $process = new swoole_process(function(){ //这里写业务代码 },true) //开启进程,返回进程pid $pid = $process->s ...

  5. [bcc32 Error] ws2def.h(231): E2238 Multiple declaration for 'sockaddr'

    [bcc32 Error] ws2def.h(231): E2238 Multiple declaration for 'sockaddr'  Full parser context    ksrGe ...

  6. flex 上下div固定, 中间div自适应

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  7. XML中的变量传值

    在action的java类中定义变量之后,在XML中获取该变量进行对应传值:: 在指定方法中获取XML配置文件的变量传值::

  8. Linux下查看与修改mtu值

    MTU:通信术语 最大传输单元(Maximum Transmission Unit)是指一种通信协议的某一层上面所能通过的最大数据包大小(以字节为单位). 我们在使用互联网时进行的各种网络操作,都是通 ...

  9. UGUI 判断元素进入舞台

    void LateUpdate () { if(!_isLoaded){ RectTransform rectt=this.GetComponent<RectTransform>(); f ...

  10. 【373】LabelEncoder 相关

    OneHotEncoder独热编码和 LabelEncoder标签编码 pandas.DataFrame.groupby