I think the reason is Android 3.0 and above, you need to do network operation like http request and all in seperate thread then the UI thread. You are directly using the code in UI thread so it works below HoneyComb. So you need to put a web request in seperate thread then UI. AsyncTask
is a good option.
For more detail check this link.