Adamp's answer is correct (it got to it before I could post).
Just for extension on it, this is the source of the Intent(Context packageContext, Class<?> cls) constructor Intent(Context packageContext, Class<?> cls) ...
public Intent(Context packageContext, Class<?> cls) { mComponent = new ComponentName(packageContext, cls); }
... and this is the source of the ComponentName(Context pkg, Class<?> cls) constructor ComponentName(Context pkg, Class<?> cls)
public ComponentName(Context pkg, Class<?> cls) { mPackage = pkg.getPackageName(); mClass = cls.getName(); }
As adamp implies, Intent methods that accept Context are convenient methods that use it only to create a ComponentName , which in turn only deals with String types ( mPackage and mClass ). Neither Intent nor ComponentName contain a reference to Context .
source share