2意图过滤器,1个活动 - 这打开了它?过滤器、意图、打开了

2023-09-07 00:54:04 作者:孤独成性原谅我只会伴友

有没有办法知道哪些意图过滤器负责启动其在AndroidManifest.xml中定义了两个意向过滤器的活动?我希望有一个略有不同的逻辑,但还不够,应该需要一个全新的活动。

Is there a way to know which Intent Filter is responsible for launching an Activity which has two Intent Filters defined in AndroidManifest.xml? I want a slightly different set of logic, but not enough that should require a whole new Activity.

谢谢!

推荐答案

没关系,发现了它。只是不看够硬...

Never mind, found it. Just wasn't looking hard enough...

使用 this.getIntent()的getAction()在你的活动会吐出正是我一直在寻找,一个字符串,以确定哪些意向筛选器操作打开了它。

Using this.getIntent().getAction() in your Activity will spit out exactly what I was looking for, a String to identify which Intent Filter Action opened it.

 
精彩推荐
图片推荐