[英]How to call activity from another application and launch that activity in another app stack?
I have tow apps : 我有两个应用程序:
MainActivity
and this Activity has intent filter with this schema: android:scheme=madeed-manager
. madeed manager:具有名为MainActivity
启动器活动,并且该Activity具有以下模式的意图过滤器: android:scheme=madeed-manager
。 madeed app has a button which direct the user to madeed manager . madeed应用程序具有一个按钮,可将用户定向到madeed经理 。 by running this code : 通过运行以下代码:
String url = "madeed-manager://";
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
context.startActivity(intent);
the code works fine and madeed manager
MainActivity launches. 该代码可以正常工作, madeed manager
MainActivity启动。 but the problem that madeed manager
activity is added to madeed stack . 但是,这个问题madeed manager
活动添加到madeed堆栈。 so if the user tab on madeed app icon . 因此,如果用户点击了Madeed应用图标。 madeed manager will appear. 制成的经理将出现。 How to let the activity to be launched in another stack. 如何使活动在另一个堆栈中启动。 thanks 谢谢
EDIT : when i add FLAG_ACTIVITY_NEW_TASK flag, then it works normally. 编辑:当我添加FLAG_ACTIVITY_NEW_TASK标志时,它可以正常工作。 but i don't know the reason. 但我不知道原因。
Follow 2 Steps: 遵循2个步骤:
1: Add an <intent-filter>
to the third activity with a action: 1:通过操作将<intent-filter>
添加到第三个活动:
<intent-filter>
<action android:name="com.package.xxxx.yyyyy.SOMETHING"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
2: Start Intent 2:开始意图
startActivity(new Intent("com.package.xxxx.yyyyy.SOMETHING")); startActivity(new Intent(“ com.package.xxxx.yyyyy.SOMETHING”));
enter code here
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.