zoukankan      html  css  js  c++  java
  • android 在manifest 中设置 多个Activity时的 默认 根 Activity

    An <activity> element can also specify various intent filters—using the <intent-filter> element—in order to declare how other application components may activate it.

    When you create a new application using the Android SDK tools, the stub activity that's created for you automatically includes an intent filter that declares the activity responds to the "main" action and should be placed in the "launcher" category. The intent filter looks like this:

    <activity android:name=".ExampleActivity" android:icon="@drawable/app_icon">
       
    <intent-filter>
           
    <action android:name="android.intent.action.MAIN" />
           
    <category android:name="android.intent.category.LAUNCHER" />
       
    </intent-filter>
    </activity>

    The <action> element specifies that this is the "main" entry point to the application. The <category> element specifies that this activity should be listed in the system's application launcher (to allow users to launch this activity).

    If you intend for your application to be self-contained and not allow other applications to activate its activities, then you don't need any other intent filters. Only one activity should have the "main" action and "launcher" category, as in the previous example. Activities that you don't want to make available to other applications should have no intent filters and you can start them yourself using explicit intents (as discussed in the following section).

    However, if you want your activity to respond to implicit intents that are delivered from other applications (and your own), then you must define additional intent filters for your activity. For each type of intent to which you want to respond, you must include an <intent-filter> that includes an <action> element and, optionally, a <category> element and/or a <data> element. These elements specify the type of intent to which your activity can respond.

    For more information about how your activities can respond to intents, see the Intents and Intent Filters document.

  • 相关阅读:
    你都这么拼了,面试官TM怎么还是无动于衷
    js中string转map的方法
    如何使用jmeter做一个功能的性能测试
    如何看待远程办公?
    vue.js指令v-for使用以及下标索引的获取
    v-charts x轴字体斜显示
    Linux-(inotify-tools&rsync)
    Linux-(type,vim)
    zab协议
    数据库的规范一览
  • 原文地址:https://www.cnblogs.com/freeliver54/p/2060152.html
Copyright © 2011-2022 走看看