Prabhu M
Prabhu M

Reputation: 3600

Android: calling activities of other application from my application in android

I want to call other apps activity from my app. So I am using the following code

  Intent i = new Intent();
  i.setComponent(new ComponentName("com.android.DailyDeals", 
                           "com.android.DailyDeals.TodaysDeals_AM" ));
  startActivity(i);

But I am getting following exception:

Caused by: java.lang.SecurityException: Permission Denied: 
       starting Intent { cmp=com.android.DailyDeals/.TodaysDeals_AM } from 
       ProcessRecord{44f9b8b0 399:com.prabhu.android/10041} (pid=399, uid=10041) 
       requires null.

How to resolve this?

Upvotes: 2

Views: 541

Answers (1)

Amandeep singh
Amandeep singh

Reputation: 1883

i think this will help you make code in your java file like this.

startActivity(new Intent("com.name of your class"));you have to write your package name .classname inside it.
& also declare this activity into your **mainfest** file

    <activity android:name=".name of your class"
                      android:label="@string/app_name">
                <intent-filter>
                    <action android:name="com.diffrentview.MYFILE" />
                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>

Upvotes: 2

Related Questions