title: Show dialog from background thread - problem
body: <p>In my app while copying files I want to ask user whether he wants to overwrite the file with same name, skip, etc. Here is some code from the thread:</p>
  
  <pre><code>        if(target.exists()){
              synchronized(this){
                  while(wait){
                      try{
                          popupHandler.sendMessage(popupHandler.obtainMessage(0, target));
                          wait();
                      }catch (Exception e){
                          e.printStackTrace();
                      }
                  }
              }
          }
  </code></pre>
  
  <p>Here is my handler:</p>
  
  <pre><code>    Handler popupHandler = new Handler(){
          @Override
          public void handleMessage(Message m){
              c.showConfirmDialog("The file " + ((File)m.obj).getName() + " exists. What do you want to do?",
                      "Overwrite", "Skip", "Keep both", Explorer.PASTE_CONFIRM, null);
          }
      };
  </code></pre>
  
  <p>After choosing an option from dialog something like that is called:</p>
  
  <pre><code>public void resume(){
      synchronized(copyThread){
              copyThread.wait = false;
              copyThread.notify();
          }
  }
  </code></pre>
  
  <p>And here goes the problem. The copyThread on resume() is always null. I can't find what is wrong because the same scheme with pausing the thread works in my other class. It looks like the thread is dying after sending the message:/ Any ideas? Thanks in advance.</p>