I am writing an android application to make server socket and receive messages from server
when I write the same application using Thread, it works pretty well but I am unable to access UI elements in Thread
whereas in case of services, startService method hangs on while(true){ socket.accept()}
You can read about threads and Android on the official documentation. Also, take a look at AsyncTask, that should help you a great lot.