From one of my apps, I'm trying to launch another. I want to use an explicit intent.
ComponentName cn = new ComponentName("com.myOtherApp", "OtherAppActivity"); Intent intent = new Intent(); intent.setComponent(cn); context.startActivity(intent);
When I run that code, however, it asks if I've declared that activity in my manifest. However, when I put the following into the manifest, I get the same error:
<activity android:name="com.myOtherApp.OtherAppActivity"> </activity>
What am I doing wrong?
Thanks
Try something like this...
In the manifest for 'myOtherApp' use an intent filter for 'OtherAppActivity' with a company specific intent, example...
<activity android:name=".OtherAppActivity" android:label="@string/app_name" > <intent-filter> <action android:name="com.mycompany.DO_SOMETHING" /> </intent-filter> </activity>
Then, in the 'calling' app, use...
Intent intent = new Intent(); intent.setAction("com.mycompany.DO_SOMETHING"); context.startActivity(intent);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With