title: Android: How to Handle Back Press Specifically?
body: <p>Let me explain more detail.</p>
  
  <p>First of all; I know that if user press back and returns the previous activity, the previous activity triggers <code>onResume</code> method properly. This is okay. </p>
  
  <p>There is a root activity in my application and it's directing 4 different activities through the buttons. I want to learn, on which activity did user press back button?  Is it possible to use something like <code>Handler</code> or similar?</p>
  
  <p>Actually, I've found a solution verdantly. I've 4 different static Boolean vars an each one represents one Activity. Let me show in code:</p>
  
  <pre><code>public class MainActivity extends Activity { // This is root
  
      static Boolean activityA;
      static Boolean activityB;
      static Boolean activityC;
      static Boolean activityD;
  
      public void onClick(View v) {
          if(v == ActivitvyA) //of course psuedo 
               activityA = true
          //...there are similar controls
      }
  
      protected void onResume() {
          if(activitiyA) // If true, this means the user pressed back on ActivityA
      }
  
  }
  </code></pre>
  
  <p>What do you think? Is there any diffent and effecient way?</p>
  
  <p>Any helps would be great.</p>