博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Android 隐式调用 intent
阅读量:4310 次
发布时间:2019-06-06

本文共 964 字,大约阅读时间需要 3 分钟。

使用action name,举例:

1. 比如建立activity4,我们对它的AndroidManifest.xml修改一下

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

      package="net.devdiv.activity4"

      android:versionCode="1"

      android:versionName="1.0">

    <application android:icon="@drawable/icon" android:label="@string/app_name">

        <activity android:name=".activity4"

                  android:label="@string/app_name">

            <intent-filter>

                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />

            </intent-filter>

           <intent-filter>

                <action android:name="devdiv.intent.action.activity4" />

                <category android:name="android.intent.category.DEFAULT" />

            </intent-filter>

        </activity>


    </application>

    <uses-sdk android:minSdkVersion="7" />


</manifest>

2. 新建一个新工程activity5

启动activity4的方法为

            Intent intent = new Intent("devdiv.intent.action.activity4");

            startActivity(intent);

转载于:https://www.cnblogs.com/sfshine/archive/2012/04/18/2524490.html

你可能感兴趣的文章
Error:fatal: Not a git repository (or any of the parent directories): .git
查看>>
15 可视化工具 Navicat的简单使用
查看>>
神兵利器:Burpsuite工具分享与使用简介
查看>>
xml
查看>>
使用 Left Join 的一个错误说明
查看>>
Scala入门系列(十一):模式匹配
查看>>
Sql Server 生成数据透视表 (行列转换等经典SQL语句)
查看>>
理解sizeof()
查看>>
Vue学习笔记之vue-cli脚手架安装和webpack-simple模板项目生成
查看>>
SqlServer 扩展属性
查看>>
优先队列
查看>>
一些程序和工具
查看>>
java8 运算语法集
查看>>
IDEA关于重命名
查看>>
Es6 中let var和 const 了解
查看>>
巧用队列之”Voting“
查看>>
Oracle数据类型number(m,n)
查看>>
C#多线程学习(一) 多线程的相关概念
查看>>
JS构造函数、原型对象、隐含参数this
查看>>
注册用户
查看>>