ComponentName comp = new ComponentName("PackageName","ClassName");
intent = new Intent();
intent.setComponent(comp);
intent.setAction("android.intent.action.VIEW");
startActivity(intent);
这种方式,当我们在手机launcher下启动一个应用,进入我们程序中启动的话用这种方式会新启动一个;
避免重新启动新的,我们可以这样做,增加设置,如下:
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);