title: Returning from a dialog or activity with result
body: <p>I would like to know if I can freeze the current Activity, while I wait for another activity or dialog (any would do) to finish.</p>
  
  <p>I know I can start an activity for results, and handle those there, but the code after startActivityForResult() will still get executed</p>
  
  <p>this is something I would like to do:</p>
  
  <pre><code>PopupDialog dialog = new PopupDialog(this,android.R.style.Theme_Black_NoTitleBar);
  dialog.show();
  // wait here, and continue the code after the dialog has finishes
  int result = getResultFromDialogSomehow();
  if (result == 1){
      //do something
  }else{
      //do something else
  }
  </code></pre>
  
  <p>I know this must sound quite weird, but but I would really appreciate it if anyone can tell me how to achieve such functionality.</p>