【发布时间】:2021-11-09 04:01:41
【问题描述】:
Intent launchFacebookApplication=getApplicationContext().getPackageManager().getLaunchIntentForPackage("com.google.android.apps.messaging");
launchFacebookApplication.addCategory(Intent.ACTION_MAIN);
startActivity(launchFacebookApplication);
或
ComponentName compName=new ComponentName("com.google.android.apps.messaging","com.google.android.apps.messaging");
Intent intent=new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
//intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setComponent(compName);
startActivity(intent);
and in manifest:-
<queries>
<package android:name="com.google.android.apps.messaging"/>
</queries>
并得到错误:-
PID: 2824
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.google.android.apps.messaging/com.google.android.apps.messaging}; have you declared this activity in your AndroidManifest.xml?
此代码有任何错误,请帮助我解决此问题
【问题讨论】:
标签: android android-11