title: Android Multiple Handlers Design
body: <p>This question is related to an <a href="https://stackoverflow.com/questions/2829595/android-2-1-muliple-handlers-in-a-single-activity">existing question</a> I asked. I though I'll ask a new question instead of replying back to the other question.</p>
  
  <blockquote>
    <p>"I've more than one Handlers in an Activity." Why? If you do not want a complicated <code>handleMessage()</code> method, then use <code>post()</code> (on <code>Handler</code> or <code>View</code>) to break the logic up into individual <code>Runnables</code>. Multiple <code>Handlers</code> makes me nervous. — CommonsWare</p>
  </blockquote>
  
  <p>I'm new to Android. My question is - is having multiple handlers in a single activity a bad design?</p>
  
  <p>Here is the sketch of my current implementation. </p>
  
  <p>I've a <code>mapActivity</code> that creates a data thread (a UDP socket that listens for data). My first handler is responsible for sending data from the data thread to the activity. </p>
  
  <p>On the map I've a bunch of "dynamic" markers that are <code>refreshed</code> frequently. Some of these markers are video markers i.e., if the user clicks a video marker, I add a  <code>ViewView</code> that extends a <code>android.opengl.GLSurfaceView</code> to my map activity and display video on this new vide. I use my second handler to send information about the marker that the user tapped on <code>ItemizedOverlay</code> <code>onTap(int index)</code> method. </p>
  
  <p>The user can close the video view by tapping on the video view. I use my third handler for this. </p>
  
  <p>I would appreciate if people can tell me what's wrong with this approach and suggest better ways to implement this. </p>
  
  <p>Thanks.  </p>