android.os.NetworkOnMainThreadException

This question already has an answer here:

  • How do I fix android.os.NetworkOnMainThreadException? 49 answers

  • you can put the below code in oncreate. but it wont solve the problem it will only hide it.

    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); 
    StrictMode.setThreadPolicy(policy);
    

    what you actually need to do is put network related code in your createExpandableListViewDialog(); (the http request part) inside a background thread.

    链接地址: http://www.djcxy.com/p/29544.html

    上一篇: 将网址转换为NetworkOnMainThreadException中的位图

    下一篇: android.os.NetworkOnMainThreadException