A memo on how to call Activities from external packages in Android.
You can do this by directly specifying it using the setClassName method of the Intent class as shown below.
(Example) Calling activity com.example.spam.activity.MainActivity
final Intent intent = new Intent();
intent.setClassName("com.example.spam", "com.example.spam.activity.MainActivity");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
activity.startActivity(intent);
activity.finish();
By the way, the setClassName method has several ways to pass arguments, but in this case we’re using it like this:
Intent setClassName(String packageName, String className)
Convenience for calling setComponent(ComponentName) with an explicit application package name and class name.
[References]
・Android Intentで画面遷移する(明示的Intent) | Tech Booster
That’s all from the Gemba.