Android-Close Other Apps
<p>I have some code that will launch a different application using intents but what can I do to close or kill the other app?</p>

<p>Here is the launch code (works great):</p>

<pre><code>Intent i = new Intent();
  i.setAction(Intent.ACTION_MAIN);
  i.addCategory(Intent.CATEGORY_LAUNCHER);
  i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  i.setComponent(
     new ComponentName(resolveInfo.activityInfo.applicationInfo.packageName, 
       resolveInfo.activityInfo.name));
</code></pre>

<p>I tried to kill the background processes but no luck:</p>

<pre><code>ActivityManager activityManager = (ActivityManager) context.getSystemService(context.ACTIVITY_SERVICE);
  activityManager.killBackgroundProcesses("com.pandora.android");
</code></pre>

<p>I also tried this to kill it:</p>

<pre><code>context.stopService(new Intent(context, Class.forName("com.bla.bla")));
</code></pre>

<h3>Update:</h3>

<p>I want to kill other applications because I launch other applications and users have requested this additional feature (auto kill is a natural extension of auto launch). Please answer the question of how to accomplish this in code. I know about Advanced Task Mgr so it is possible but how?</p>
