android.intent.action.MAIN 是什么意思? [英] What is the meaning of android.intent.action.MAIN?

查看:25
本文介绍了android.intent.action.MAIN 是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过很多不同的令人困惑的解释..

I have seen so many different confusing explenations..

<intent-filter>
     <action android:name="android.intent.action.MAIN" /> 
     <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

什么意思

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

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

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

推荐答案

android.intent.action.MAIN 表示这个activity是应用的入口点,即当你启动应用时,此活动已创建.

android.intent.action.MAIN means that this activity is the entry point of the application, i.e. when you launch the application, this activity is created.

来自文档

ACTION_MAIN with category CATEGORY_HOME -- Launch the home screen.

另外,来自这里

Activity Action Start 作为一个主要的入口点,没想到接收数据.

Activity Action Start as a main entry point, does not expect to receive data.

android.intent.category.DEFAULT 主要用于隐式意图.如果您的活动希望通过隐式意图启动,则应在其过滤器中包含此类别.如果您的 Activity 可能在没有指定特定类别的情况下由隐式 Intent 启动,则其 Intent 过滤器应包含此类别.

android.intent.category.DEFAULT is mainly used for implicit intents. If your activity wishes to be started by an implicit intent it should include this catetory in its filter. If your Activity might be started by an implicit Intent when no specific category is assigned to it, its Intent filter should include this category.

android.intent.category.LAUNCHER

category -- 提供有关要执行的操作的附加信息.

category -- Gives additional information about the action to execute.

CATEGORY_LAUNCHER 表示它应该作为顶级应用程序出现在启动器中

CATEGORY_LAUNCHER means it should appear in the Launcher as a top-level application

查看文档..

  1. http://developer.android.com/reference/android/content/Intent.html
  2. http://developer.android.com/guide/topics/manifest/action-element.html

这篇关于android.intent.action.MAIN 是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆