get name of activity within Intent

CQM picture CQM · Jan 17, 2013 · Viewed 22.4k times · Source

I am using some various ad networks, they all require their own activity names to be added to the manifest.

I want to know when users click them, so I put in an override for startActivity(Intent intent) but I need to inspect the intent object to conditionally set some values.

for instance, with tap for tap's network, it will launch an activity from the class com.ads.TapForTap.. upon a click this will call startActivity(Intent intent) how do I get the name of the class from the intent?

thanks

Answer

user3294126 picture user3294126 · Jul 7, 2014

You can use the given intent argument's component class name. Remember the class name might be empty!

intent.getComponent().getClassName()