title: android one time login system
body: <p>I am trying to design a one time login system.</p>
  
  <ul>
  <li><p>On the loginActivity the user enters a phone number to which I send a secret code thru SMS</p></li>
  <li><p>On the confirmationActivity the user enters the secret code.</p></li>
  </ul>
  
  <p>If the secret code is successful, I want to <code>finish</code> both confirmationActivity and loginActivity. To do that from loginActivity I do</p>
  
  <pre><code>Intent intent = new Intent(this, ConfirmationActivity.class);
  startActivityForResult(intent, EXIT_CODE);
  </code></pre>
  
  <p>Then again in loginActivity I call</p>
  
  <pre><code>@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK) {
      if (requestCode == EXIT_CODE) {
        finish();
      }
    }
  }
  </code></pre>
  
  <p>To test whether my system works, after registration, I click on the back button:</p>
  
  <ul>
  <li><p>Expected behavior: Not being able to go back or close the app</p></li>
  <li><p>Actual behavior: go back to the loginActivity (notice that it skips the confirmationActivity)</p></li>
  </ul>
  
  <p>My hope is that once a user successfully registers they should never again get access to either the confirmationActivity or the loginActivity. And that when they close my app and restart it, it skips those two pages and take the user directly to the home page.</p>
  
  <p>Note: It looks like the <code>onActivityResult</code> method is never called. I place a few println calls in there and they are never printed on LogCat.</p>
  
  <p>DISCLAIMER: Last time I asked a question and showed a code snippet, one respondent got distracted and started talking about the snippet instead of addressing the question. The snippet here is just to show what I have tried. Obviously it has not solved the problem. Thank you.</p>