开发者

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

开发者 https://www.devze.com 2023-03-21 10:57 出处:网络
I want to call other apps activity from my app. So I am using the following code Intent i = new Intent();

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?


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消