Intent intent = new Intent();
intent.setClassName("another_app_package_name","another_app_package_name.class_name_in_that_package");
startActivity(intent);
获取 ActivityNotFoundException ?
如何解决这个问题?这个问题早先发布但没有解决方案。我的应用程序的清单文件,其活动被调用我也使用了意图过滤器。
Activity to be called by some other application's activity
<activity
android:name="com.example.custompermission.PrivActivity">
android:permission="abc.permission.STARTMYACTIVITY">
<intent-filter >
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
答案 0 :(得分:0)
检查
Intent intent = new Intent();
intent.setClassName(another_app_package_name.this,another_app_package_name.class_name_in_that_package.class);
startActivity(意向);
并在manifest.xml中添加此
<activity android:name="another_app_package_name.class_name_in_that__package" android:configChanges="orientation|keyboardHidden"></activity>
答案 1 :(得分:0)
在清单文件中,您确实喜欢这样:
<activity android:name="another_app_package_name.class_name_in_that__package"></activity>
您应该在清单文件中添加活动,您尝试从第一个活动中调用该活动。
您需要在清单文件中添加两个活动: 例如:
Intent intent = new Intent (HomePage.this, Second.class);
startActivity(intent);
in manifest: <application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".HomePage"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name =".Second"></activity>
</application>
一次,清理项目并运行。