在停止启动startActivity的应用程序时遇到了一些问题。这是我如何启动它:停止刚启动的正在运行的应用程序
Intent theApp = new Intent();
theApp = getPackageManager().getLaunchIntentForPackage(thePackageName);
theApp.addCategory(Intent.CATEGORY_LAUNCHER);
theApp.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(theApp);
它已经跑了一段时间后,即时通讯试图阻止这样的:
if(stopService(theApp))
Log.d(TAG,"Stopped app successfully!");
else
Log.d(TAG,"Failed to stop the app!");
任何想法,为什么这个心不是工作?在此先感谢您的帮助
Call finish();这会杀死它。 – g00dy
你能告诉我们真正完整的代码吗? – Opiatefuchs
你正试图杀死你开始的外部应用程序..对吗? –