[转载]httpClient.execute抛Connection to refused异常问题
生活随笔
收集整理的這篇文章主要介紹了
[转载]httpClient.execute抛Connection to refused异常问题
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
在4.0之后android采用了嚴(yán)格模式:所以在你得activity創(chuàng)建的時(shí)候,在super.onCreate(savedInstanceState);后面加上這個(gè)
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectAll() // or .detectAll() for all detectable problems
.penaltyLog()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.detectLeakedClosableObjects()
.penaltyLog()
.penaltyDeath()
.build());
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectAll() // or .detectAll() for all detectable problems
.penaltyLog()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.detectLeakedClosableObjects()
.penaltyLog()
.penaltyDeath()
.build());
轉(zhuǎn)載于:https://www.cnblogs.com/studynote/articles/5522774.html
總結(jié)
以上是生活随笔為你收集整理的[转载]httpClient.execute抛Connection to refused异常问题的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 中信腾讯圣斗士星矢手游联名卡VISA版V
- 下一篇: MSN8.0经常出现连接错误,如何解决?