title: Dispatch messages in message queue individually
body: <p>Is it possible to dispatch each queued messages in message queue individually? The messages will be displayed/viewed first to a dialog and then the next one after clicking ok/proceed and soon. </p>
  
  <p>I would be using Thread and will just dynamically add a message to message queue.</p>
  
  <p>I've follow this book,<a href="https://www.safaribooksonline.com/library/view/efficient-android-threading/9781449364120/ch04.html" rel="nofollow noreferrer">click here</a> but could not find any to solve this</p>
  
  <p>I have this code so far:</p>
  
  <pre><code>private static class LooperThread extends Thread {
  
      private String TAG = "LooperThread";
  
      public Handler mHandler;
  
      public void run() {
          Looper.prepare();
          mHandler = new Handler() {
              public void handleMessage(Message msg) {
  
                  if(msg.what == 0) {
                      doLongRunningOperation();
                      Log.e(TAG,"doLongRunningOperation - 0");
                  }else{
                      Log.e(TAG,"doLongRunningOperation - 1");
                  }
              }
          };
          Looper.loop();
      }
  
      private void doLongRunningOperation() {
          // Add long running operation here.
      }
  
  }
  
  
  btn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              if (mLooperThread.mHandler != null) {
                  Message msg = mLooperThread.mHandler.obtainMessage(0);
  
                  Message msg2 = mLooperThread.mHandler.obtainMessage(1);
  
                  mLooperThread.mHandler.sendMessage(msg);
  
                  mLooperThread.mHandler.sendMessage(msg2);
              }
          }
      });
  </code></pre>
  
  <p>But when I pressed the btn, all messages will be printed.</p>
  
  <p>Is there a best way to implement this technique?What do you recommend?</p>