我想从我的应用中调用其他应用活动。所以我使用以下代码
Intent i = new Intent();
i.setComponent(new ComponentName("com.android.DailyDeals",
"com.android.DailyDeals.TodaysDeals_AM" ));
startActivity(i);
但我得到以下异常:
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.
如何解决这个问题?
答案 0 :(得分:2)
我认为这会对你有所帮助 像这样在你的java文件中创建代码。
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>