You're attempting to make a network connection on the main (UI) thread. This is not allowed in Android since it will halt the entire UI until you get a response from the server.
Try using AsyncTask, or performing the connection on a separate thread.
Hope this helps.