title: Why isn't setVisibility working on Android ProgressBar?
body: <p>It would be nice if the ProgressBar could be made to go away until it is needed. Is there a problem using setVisibility.progressBar in applyMenuChoice? The problem with using setVisibility.progressBar in PrintStatusTask().execute() is that it crashes the app during runtime.</p>
  
  <pre><code>public class Controller extends Activity {
      private ProgressBar progressBar;
      ...
  
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.controller);
          progressBar = (ProgressBar)findViewById(R.id.progressBar);
          ...
  
      private boolean applyMenuChoice(MenuItem item) {
          switch (item.getItemId()) {
          case R.id.menuStatus:
              progressBar.setVisibility(View.VISIBLE);
              new PrintStatusTask().execute();
              progressBar.setVisibility(View.GONE);
              ...
  </code></pre>