title: android programming how to handle onclick() events when the program is running a different thread which is running as a server?
body: <p>I have a thread running the server sends a data to a client and receives a data from the client.</p>
  
  <p>the server/client program am running is a modifed version of</p>
  
  <p>code found at
   <a href="https://stackoverflow.com/questions/4683854/connecting-2-emulator-instances-in-android">Connecting 2 Emulator instances In Android</a></p>
  
  <p>After that happens . If a press a button. I need to perform some onclick events. But my program is receiving some<br>
      Android:android.view.ViewRoot$CalledFromWrongThreadException</p>
  
  <p>I looked and found tht we should use handler for these errors.
  But am not sure how to combine a handler with an onclick() event function ?</p>