我想从我的应用中启动应用Aapp和Bapp的两个特定活动A_Activity和B_Activity 我插入了两个按钮并在我编写的两个OnClickListener中
Intent intent = new Intent();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction("com.Acompany.Aapp.A_Activity");
ctx.startActivity(intent);
Intent intent = new Intent();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction("com.Bcompany.Bapp.B_Activity");
ctx.startActivity(intent);
此外,我在AndroidManifest.xml中添加了以下行
<activity
android:name="com.Acompany.Aapp.A_Activity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.Acompany.Aapp.A_Activity" />
</intent-filter>
</activity>
<activity
android:name="com.Bcompany.Bapp.B_Activity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.Bcompany.Bapp.B_Activity" />
</intent-filter>
</activity>
但是我的应用程序崩溃并且在logcat中我读到“No Activity found to handle Intent” 我的错误在哪里?
编辑:更确切地说,这两项活动不在我自己的应用程序中
答案 0 :(得分:0)
试试这样。对于您的家庭活动(首次启动活动),请在清单file.xml
中执行此操作<activity
android:name="com.Acompany.LaunchHomeActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.Acompany.LaunchHomeActivity" />
</intent-filter>
</activity>
<activity android:name="com.Acompany.Aapp.A_Activity">
</activity>
<activity android:name="com.Bcompany.Bapp.B_Activity">
</activity>
不要在所有活动中加入<intent-filter>
答案 1 :(得分:0)
更确切地说,这两项活动不在我自己的应用程序中
您应首先调查目标应用的清单文件,以检查这些活动是否可通过导出或提供可公开访问的意图过滤器供他人使用。看起来你可能根本不被允许做你想做的事。
答案 2 :(得分:0)
Intent intent = new Intent(myFirstClass.this, MySecondClassA.class);
startActivity(intent);
B类
Intent intent = new Intent(myFirstClass.this, MySecondClassB.class);
startActivity(intent);