title: Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_NEW_TASK not working Android
body: <p>well, so, that´s my problem.</p>
  
  <p>I need, when the user press the back bottom, to delete the stack of all activities opened:</p>
  
  <pre><code>@Override
  public void onBackPressed(){
      Intent i = new Intent(context, CrisolMainApp.class);
      i.putExtra(CrisolMainApp.CERRAR_APP, true);
      i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_NEW_TASK);
      startActivity(i);
  }
  </code></pre>
  
  <p>The point is that this is working with most of my phones, but yesterday I tried with a Samsung Galaxy Mini (android 2.3.3) and it is not working!! It is not deleting the stack of activities.</p>
  
  <p>Anyone knows why?</p>
  
  <p>EDIT: I was checking on doc, and I found out that the "Intent.FLAG_ACTIVITY_CLEAR_TASK" was added on API 11(my Samsung Galaxy Mini is working for Android 2.3.3, so, API 10).......I don´t know, but I guess that´s the problem.</p>
  
  <p>Anyone knows how can I make it work the same way for API less than 11?</p>
  
  <p>I was trying by adding these flags and it is not working either:</p>
  
  <pre><code>@Override
  public void onBackPressed(){
      Intent a = new Intent(this, CrisolMainApp.class);
      a.putExtra(CrisolMainApp.CERRAR_APP, true);
      a.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_NEW_TASK);
      a.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      a.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
      startActivity(a);
      finish();
  }
  </code></pre>
  
  <p>and I also tried:</p>
  
  <pre><code>@Override
      public void onBackPressed(){
          Intent a = new Intent(this, CrisolMainApp.class);
          a.putExtra(CrisolMainApp.CERRAR_APP, true);
          a.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
          a.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
          startActivity(a);
          finish();
      }
  </code></pre>