I created aar and I added it to my project as a module. in this module, I have HelloWorldActivity that I want to run.
my manifest module looks like this.
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="ir.sibvas.testlibary1.HelloWorldActivity" android:label="@string/app_name" > <intent-filter> <action android:name="ir.sibvas.testlibary1.HelloWorldActivity" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> <activity android:name=".MainActivity" android:label="@string/title_activity_main" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application>
Now I can start this activity from my project using this code
Intent intent = new Intent("ir.sibvas.testlibary1.HelloWorldActivity"); startActivity(intent);
but, as you can see, this code is implicit, and the problem with the implicit call is that if I use this module in more than one application, both installed on the user device, it will display the application selection dialog for the user. So, how to make this call explicit without letting the user switch the application?
this code will not work since HelloWorldActivity is not in the same package as call activity
Intent intent = new Intent(this, HelloWorldActivity.class); startActivity(intent);
I really do not want to change my module for every project that uses it.
source share