标签:mode color main sqllite read details oncreate tle set
解决办法:
在发起Http请求的Activity里面的onCreate函数里面添加如下代码:
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectDiskReads().detectDiskWrites().detectNetwork() .penaltyLog().build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() .detectLeakedSqlLiteObjects().detectLeakedClosableObjects() .penaltyLog().penaltyDeath().build());
其他方法见:http://blog.csdn.net/mad1989/article/details/25964495
NetworkOnMainThreadException异常
标签:mode color main sqllite read details oncreate tle set
原文地址:http://www.cnblogs.com/SkyLeo/p/6883602.html