title: How to stop (Force-Stop) other app programmatically Android?
body: <p>I'm trying to stop others applications programmatically and i saw many samples, but didn't work.</p>
  
  <pre><code>try {
      ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
  
      Process.killProcess(p.pid);
      Process.sendSignal(p.pid, Process.SIGNAL_KILL);
      manager.killBackgroundProcesses(p.getPackageName());
  } catch (Exception e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>It didn't work, but i saw other way to do it over adb and it work.</p>
  
  <pre><code>adb shell am force-stop packagename
  </code></pre>
  
  <p>Could anyone tell me if is it possible to force-stop an application ?</p>