caused by:android.os.NetworkOnMainThreadException
At Android.os.strictmode$androidblockguardpolicy.onnetwork (Strictmode.java)
At Java.net.InetAddress.lookupHostByName (inetaddress.java:388)
At Java.net.InetAddress.getAllByNameImpl (inetaddress.java:239)
At Java.net.InetAddress.getAllByName (inetaddress.java:214)
At Libcore.net.http.httpconnection.<init> (httpconnection.java:70)
At Libcore.net.http.httpconnection.<init> (httpconnection.java:50)
At Libcore.net.http.httpconnection$address.connect (httpconnection.java:340)
At Libcore.net.http.HttpConnectionPool.get (httpconnectionpool.java:87)
At Libcore.net.http.HttpConnection.connect (httpconnection.java:128)
At Libcore.net.http.HttpEngine.openSocketConnection (httpengine.java:315)
At Libcore.net.http.HttpEngine.connect (httpengine.java:310)
At Libcore.net.http.HttpEngine.sendSocketRequest (httpengine.java:289)
At Libcore.net.http.HttpEngine.sendRequest (httpengine.java:239)
At Libcore.net.http.HttpURLConnectionImpl.connect (httpurlconnectionimpl.java:80)
There is no problem running on 2.3 of the phones, this exception will occur on the phone after 2.3.
After 2.3 Android does not allow access to the network in the main thread, because access to the network is time-consuming operation, if the main thread to access the network, when the network access is slow, the user interface will be suspended animation, resulting in Android not Response, in order to avoid this problem, 2.3 after the limit, Time-consuming operations must be done in a child thread!!!
Android Network access exception: Android.os.NetworkOnMainThreadException