创建一个不显示在启动器列表中的主要活动 [英] Creating a Main Activity which DOES NOT appear in the launcher list

查看:59
本文介绍了创建一个不显示在启动器列表中的主要活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法,让我的应用在直接从Android市场打开时可以启动活动,但不能在启动器菜单中保持活动.我认为通过使用以下设置,我将能够实现这一目标:

I'm looking for a way to have my app launch an activity when opened directly from the Android market, yet not maintain an activity in the launcher menu. I thought that by using the following settings, I would be able to achieve this:

    <activity android:name="com.package.test.MyActivity" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
        </intent-filter>
    </activity>

但是,使用这些设置,似乎活动似乎在应用中甚至不存在-无法从市场上打开它,也不会出现在启动器菜单中.但是,只需添加:

However, it appears that with these settings the Activity seemingly doesn't even exist in the app - it cannot be opened from the market and doesn't appear in the launcher menu. However, by simply adding:

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

该应用程序同时执行这两项操作.问题是我确实希望活动从市场运行,但我不希望它出现在启动器菜单中.

the app does both. The problem is I do want the activity to run from the Market, but I don't want it in the launcher menu.

有人能启发我如何实现这一目标吗?

Can anyone enlighten me as to how this can be achieved?

推荐答案

使用 android.intent.category.INFO 代替 LAUNCHER .知道这并不经常使用,但是有一个例子是如Beautiful Widgets动画之类的附加程序包,其中安装了应用程序后,Market列表之外的信息屏幕很有用,但是如果用户从未发现过,则不会造成任何伤害这项活动.

Instead of LAUNCHER, use android.intent.category.INFO. Know that this is not used often, but an example is an add-on package like the Beautiful Widgets animations, where an informational screen beyond the Market listing is useful after the app is installed, but no harm will be done if the user never discovers this activity.

(另请参阅此问题.)

这篇关于创建一个不显示在启动器列表中的主要活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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