2 Intent Filters, 1 Activity - Which opened it?

2019-02-20 03:43发布

问题:

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.

Thanks!

回答1:

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

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.