Solution 1:

Any idea why?

Because, if that hunk of code is being executed on the main application thread, you are doing network I/O on the main application thread.

I've read I might need to implement asynctask but im new to it and not sure what parts need their own thread.

I would put the network I/O and the parsing in doInBackground() and the setListAdapter() call in onPostExecute() of an AsyncTask.

Solution 2:

If you simply want to test your code, and don't want to add any more complications yet, you can add this to your onCreate()

if (android.os.Build.VERSION.SDK_INT > 9) {
      StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
      StrictMode.setThreadPolicy(policy);
}

You don't want this to be permanent, as network operations on the UI thread makes for a bad experience when using the app, but can be useful when testing.