title: Android activity life cycle: why isn't calling the super method first enforced?
body: <p>One of the requirements of basic Android development (according to the Google docs) is that when you override the activity's lifecycle methods (onCreate, onResume, onPause, etc.), you must call the parent's method first:</p>
  
  <pre><code>@Override
  protected void onResume()
  {
      super.onResume();
  }
  </code></pre>
  
  <p>Why doesn't the Android API use a non-virtual interface pattern to enforce this behavior, rather than relying on developers to remember to do so?:</p>
  
  <p>Android's Activity Base class could look something like this (crude example):</p>
  
  <pre><code>public class Activity
  {
      public final void onResume()
      {
          // do important things here
          virtualOnResume();   
      }
      protected abstract void virtualOnResume();
  }
  </code></pre>
  
  <p>Child class written by Android developer:</p>
  
  <pre><code>public class MainActivity extends Activity
  {
      @Override
      protected void virtualOnResume()
      {
          // do custom stuff here, without needing to call super.onResume()
      }
  }
  </code></pre>
  
  <p>I haven't encountered a case where I need to write any instructions prior to calling the super method. Is there any time we should NOT call the super method, or not call it first?  If it truly must always be first for any particular method in the life cycle, what was the reason behind the design decision not to use a NVI pattern to enforce it?</p>
  
  <p><strong>UPDATE:</strong>  Been developing for Android for a while now, everyone at work uses my BaseActivity NVI class, and I've still yet to encounter a reason NOT to use an NVI for all lifecycle methods but the onCreate one.  It appears that those who answered/commented in defense of the existing API design don't really have a justification, or don't really seem to understand what an NVI pattern is, so I'm going with the assumption that there is no good reason, that it's "just how it is."</p>