Android HttpClient : NetworkOnMainThreadException

后端 未结 4 1015
离开以前
离开以前 2020-11-29 12:45

I have some code below:

protected void testConnection(String url) {
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new Htt         


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 13:36

    Starting from API 11, you can not manipulate network (time-consuming) operations on main thread. Use AsyncTask or Thread to perform such operations.

提交回复
热议问题