How to kill Fragment?
<p>Well, I assumed that it should be as simple as</p>

<pre><code>fragmentManager.beginTransaction().replace(R.id.container, otherFragment).commit();
</code></pre>

<p>Should do that, but indeed not.</p>

<p>Even <code>fragmentManager.beginTransaction().remove(fragment);</code> doesn't kill it.</p>

<p>Other fragment loads, but in the Fragment I'm trying to kill there is a  SensorEventListener which continue to react even after the fragment was replaced. I can hear the sounds and stuff.</p>

<p>Of course, I can make a boolean and switch it, but it seems to me there should be another way to simply destroy this object.</p>

<p>This is how I init fragment :  </p>

<pre><code>  public static BaseGameFragment newInstance(int mode) {
      BaseGameFragment.mode = mode;
      BaseGameFragment fragment = new BaseGameFragment();   
        return fragment;
  }
</code></pre>

<p>I also try to call <code>onDestroy();</code> but it doesn't stop sensor's reaction and, therefore, all other processes within fragment.</p>