两个发射器为一个单一的活动 [英] Two launchers for a single activity
问题描述
是否有可能有多个发射它启动相同的活性的不同意图演员?
Is it possible to have multiple launchers which start the same Activity with different intent extras ?
推荐答案
有没有办法开展活动(通过启动器)时提供额外的意图
There is no way to provide intent extras when launching the activity (via the Launcher).
不过,你所能做的就是用<以活动为别名>
定义更多的应用程序图标将推出相同的(目标)活动标记
However, what you can do is use <activity-alias>
tags that define additional app icons that will launch the same (target) activity.
编辑:添加例如:
此示例显示了实体经济活动的呼叫 MyRealActivity
键,名为 Blahblah
的别名。双方有意向的过滤器,这将使他们出现可用的应用程序的列表中。他们有不同的标签,然后不同的图标,使他们看起来像2个不同的应用程序给用户。但是,他们都推出了同样的活动。请注意,有没有Java类 .Blahblah
,这只是一个占位符,并且必须是唯一的。
This example shows a real activity call MyRealActivity
and an alias called Blahblah
. Both have intent-filters that will make them appear on the list of available apps. They have different labels and different icons so that they will look like 2 different apps to the user. However, they both launch the same activity. Please note that there is no java class for .Blahblah
, that is just a placeholder and must be unique.
<activity
android:name=".MyRealActivity"
android:label="@string/header_application"
android:icon="@drawable/icon_myapp">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity-alias
android:targetActivity=".MyRealActivity"
android:name=".Blahblah"
android:label="@string/header_blahblah"
android:icon="@drawable/icon_blahblah">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity-alias>
这篇关于两个发射器为一个单一的活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!