I have a thread running the server sends a data to a client and receives a data from the client.
the server/client program am running is a modifed version of
code found at Connecting 2 Emulator instances In Android
After that happens . If a press a button. I need to perform some onclick events. But my program is receiving some
Android:android.view.ViewRoot$CalledFromWrongThreadException
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 ?
Try to use AsyncTask simplest way, no need to manage Handler for thread, put your server/client code in Asynctask's doInBackground() so your UI also not be blocked.
Look at Android Development: Implementing a simple Client-Server model
Thanks.. :-)