title: clean stack and exit app onBackPressed()
body: <p>basically my app has a loginScreen and once logged u can go through many activities. when i press the home button the app goes in background and if the user doesnt open it within a certain amount of time, the users session closes and u return to the loginScreen. now the problem is that if i want to close the app from the loginScreen once my session has expired i press the back key and it should close but it doesnt. it brings me to the previous element in the stack. </p>
  
  <p>the wired thing is that on all onBackPressed() methods and when ever i started new intents i always use <code>intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);</code>
  and on the loginScreen onBackPressed() i call <code>finish()</code>
  but it doesnt work. anyone know why? and how do i solve this problem. </p>
  
  <p>Thanks for the help!!!</p>
  
  <p>code snippets
  in many activities:</p>
  
  <pre><code>@Override
      public void onBackPressed() {
          mpButtonClick.start();
          Intent intent = new Intent(this, MenuPagina.class); 
          intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
          startActivity(intent); 
          super.onBackPressed(); 
      }
  </code></pre>
  
  <p>in the loginActivity:</p>
  
  <pre><code>@Override
      public void onBackPressed() {
          super.onBackPressed();
          getIntent().setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
          LoginActivity.this.finish();
      }
  </code></pre>