Skip to content Skip to sidebar Skip to footer

Urlconnection Doesn't Work Since Api 10 And Higher?

Hey I'm having a big issue with my android App. I'm currently updating it and I switched from API 8 to API 10 and the following block of code doesn't work anymore ... URL url = new

Solution 1:

I never faced that problem but I think the stacktrace is telling you what is wrong: NetworkOnMainThreadException

Seems like android OS is forbidding a synchronous HTTP request on the main thread, because this will block the UI. So it seems to prevent you from making bad decisions (good idea I think). You should use an AsyncTask for network requests anyway.

Solution 2:

Take a look at this article, it features some of the android HTTP clients and some of the changes they have experienced.

Android’s HTTP Clients

Post a Comment for "Urlconnection Doesn't Work Since Api 10 And Higher?"