I am creating my first library module, which I plan to populate with reusable code for several projects. My first roadblock is that I need to be able to start activity in the main application from the library module.
For example, I have a splash screen activity. It works for 2 seconds, then starts the main action. I believe that I can reuse this splash screen activity, and I want to put it in my library module. However, I am not sure how to start the main activity from the library.
Mainfest in the main application setup:
<activity android:name="com.example.myLibraryModule.SplashScreen" android:theme="@style/AppTheme.NoActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
the manifest launches the splash screen, which is currently in my library module.
Since the library is a dependency of the main application, and not vice versa, I'm not sure how to start MainActivity from my SplashScreenActivity . It's not so easy:
Intent i = new intent(this, MainActivity.class); startActivity(i);
source share