title: Alternative to direct onResume() call
body: <p>I am rewriting my <code>Android</code> app to eliminate direct calls to <code>onResume()</code>.</p>
  
  <p>My app currently does most of its work inside <code>onResume()</code> it then posts the display and that is the end of <code>onResume()</code>.</p>
  
  <pre><code>@Override
  public void onResume() {
      super.onResume();
      // get current date and time,
      //  and determine if daylight savings time is in effect.
      //...600 lines of code
      // output both the chart and report
      //
      image.setImageBitmap(heightChart);
      report.setImageBitmap(reportBitmap);
  }
  </code></pre>
  
  <p>The next step is gathering user input, which tells me what changes to the
  report the user wishes. (It may be a new location, a new date, or new display style, etc). This is done as follows: </p>
  
  <pre><code>@Override
  public boolean onOptionsItemSelected(MenuItem item) {
      final int STATION_REQUEST = 1;
      int test = 1;
      switch (item.getItemId()) {
          case R.id.refresh: {
              userDateSet = false;
              onResume();
              return true;
          } // come to the present.
  
          //...200 lines of code
          default:
              return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>As the example shows, the output is regenerated by calling <code>onResume()</code> after the new user command is determined. THIS IS BAD PRACTICE, I ALREADY KNOW!! Yet it works well as far as I have determined, I honestly do not understand the problem with it.</p>
  
  <p>My solution in mind is to gather the 600 lines of code into a separate routine and call that instead, both from within <code>onResume()</code> and numerous points within <code>onOptionsItemSelected()</code></p>
  
  <pre><code>@Override
  public void onResume() {
      super.onResume();
      myOnResumeCode();
  }
  </code></pre>
  
  <p>And inside <code>onOptionsItemSelected()</code> do this</p>
  
  <pre><code>@Override
  public boolean onOptionsItemSelected(MenuItem item) {
      final int STATION_REQUEST = 1;
      int test = 1;
      switch (item.getItemId()) {
          case R.id.refresh: {
              userDateSet = false;
              myOnResumeCode();
              return true;
          } // come to the present.
  
      ... // Other statements
  }
  </code></pre>
  
  <p>Is this method acceptable? If not, any suggestions short of "rewrite the whole thing"  will be very helpful to me. I have searched extensively for a clean solution but not found one I can understand. Thank You.</p>