zoukankan      html  css  js  c++  java
  • Android 通信的桥梁 Intent

    虽然比较简单,但还是把主要内容提一下。 

    Intent的使用

    Intent 可以启动一个Activity,也可以启动一个service,还可以发起一个广播  

    Activity                       startActivity(),startActivityForResult();

    Service                        startService(),bindService()

    BroadCast                 sendBroadcast(),sendOrderedBroadcast(),sendStickyBroadcast();

    IntentAction属性

    隐式指定:

    比如在AActivity中声明,

    My_Action = “com.king.android.my_action”;

    Intent intent = new Intent();

    Intent.setAction(My_Action);

    注意了

    BActiivty接受:

    Intent intent = getAction();

    String action =- intent.getAction();

    AndroidMainFest.xml文件

    <activity android:name=".BActivity"

                      android:label="@string/app_name">

                <intent-filter>

                    <action android:name=" com.king.android.my_action " />  指定过虑条件。

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

                </intent-filter>

            </activity>

    访问系统的Action属性,

    IntentData属性

    IntentCategory属性:

    CATEGORY_LAUNCHER,则应用程序出现在最上面, CATEGORY_HOME则回到home界面。

    IntentExtras属性虽然简单,却是重点,

    系统标准的Activity Action应用 比较多,要用的时候,自己在网上查查吧。

    Intent的策略需要注意一下

    1. Action

    2. Category

    3. Data

     

  • 相关阅读:
    vscode使用SSH Targets连接远程系统进行开发
    python2.7版本安装pip
    ubuntu系统安装最新版本nodejs
    win7安装yarn后执行报错
    Object合并,并使用默认值处理
    解决JSON.stringify序列化循环依赖对象报错
    docker环境下安装maven私服和gitlab
    单例模式的无锁实现
    【Java学习笔记】Java的垃圾回收机制
    Ubuntu下源码安装Python
  • 原文地址:https://www.cnblogs.com/liuzenglong/p/2594601.html
Copyright © 2011-2022 走看看