title: Android - Using Handlers?
body: <p>Is there any problem with using multiple Handlers in the same Activity.</p>
  
  <p>I noticed that in all samples provided in android official website they use a single handler and detect different actions depending on the value of "what", is this because of memory management, and high amount of memory used by the Handler? Or should I call it "bad code" and do it the clean way (Multiple handlers each responsible for a specific task)</p>
  
  <pre><code>Handler handler = new Handler()
  {
      @Override
      public void handleMessage(Message msg) {
        if (msg.what == 0){
           // do something
        }
        else if (msg.what == 1){
           // do something else
        }
      }
  }
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>Handler taskHandlerA = new Handler()
  {
      @Override
      public void handleMessage(Message msg) {
           // do something
      }
  }
  
  Handler taskHandlerB = new Handler()
  {
      @Override
      public void handleMessage(Message msg) {
           // do something else
      }
  }
  </code></pre>