start activity without knowing its class

Is there a way to start an Activity without knowing its class, for example via an Intent Action?

The background is, I have two Modules, ModuleMain and ModulePushNotification. ModuleMain has a dependency to ModulePushNotification. From ModulePushNotification I want to start an Activity in ModuleMain, but I cannot add a dependency ModulePushNotification -> ModuleMain because this would produce a circular dependency.

Therefore, I cannot start the activity this way:

startActivity(new Intent(this, Main.class));

I tried to start the Activity using an Intent Action:

Intent intent = new Intent("");

… with this Manifest in ModuleMain:


            <action android:name="" />
            <category android:name="ANDROID.INTENT.CATEGORY.DEFAULT" />

… but this produces the Exception:

Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { cat=[android.intent.category.DEFAULT]

Is there a way to start the main activity of the app, without restructuring the project/dependencies?

Source: android

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.