title: Return back to previous previous activity
body: <p>Here is what the structure looks like:</p>
  
  <p>Activity 1/2/3 -> Activity 4 -> Activity 5</p>
  
  <p>On Act4, if a boolean variable is true, it jumps straight to Act5.
  My problem is that when I press back on Act5, i want to get back to the activity which called Act4. But what happens is that it jumps back to Act5. If i use intent on back press, I i wouldn't know which activity called Act4.</p>
  
  <p>in onCreate of Act4, i have this code:</p>
  
  <pre><code>if (boolean) {
      Intent intent = new Intent(context, Act5.class);
      intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
      startActivity(intent);
      finish();
  }
  </code></pre>
  
  <p>Is it okay to call finish first before the startActivity?</p>
  
  <p>Thanks in advance.</p>