HttpURLConnection выдает исключение [дубликат] ⇐ Android
-
Anonymous
HttpURLConnection выдает исключение [дубликат]
Here is my code to connect HTTP.
URL url = new URL("http://www.google.com"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setDoOutput(true); String responseMsg = con.getResponseMessage(); int response = con.getResponseCode(); this is throwing android.os.NetworkOnMainThreadException
Please help.
Источник: https://stackoverflow.com/questions/154 ... -exception
Here is my code to connect HTTP.
URL url = new URL("http://www.google.com"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setDoOutput(true); String responseMsg = con.getResponseMessage(); int response = con.getResponseCode(); this is throwing android.os.NetworkOnMainThreadException
Please help.
Источник: https://stackoverflow.com/questions/154 ... -exception
Мобильная версия