title: Wait after setVisibility() until widget is truely visible in the app
body: <p>In a function handling a registration form I want to set the visibility of button to invisible and the visibility of a progress bar to visible. The problem now is, that the following code which handles some OAuth requests seems to prevent the widgets to show their visibility exactly where I want them to. </p>
  
  <p>Setting the visibility of the progressbar stops (is frozen?) until the oauth requests are finished. How can I fix that?! I think working with <code>sleep()</code>s, <code>wait()</code>s or timers would be a bad solution here...</p>
  
  <pre><code>private void registerOnce(){
  
      ProgressBar spinner = (ProgressBar) findViewById(R.id.progressBar);
      Button login = (Button) findViewById(R.id.buttonLogin);
  
      spinner.setVisibility(View.VISIBLE);
      login.setVisibility(View.INVISIBLE);
  
      // Here goes the code for some oauth requests
      // This code here seems to prevent setting the
      // the visibility where I want it to.
  
      spinner.setVisibility(View.INVISIBLE);
      login.setVisibility(View.VISIBLE);
  
  }
  </code></pre>