在android 2.3上设计的下载程序,在android 4.0上运行时报android.os.NetworkOnMainThreadExcep
- //
详见StrictMode文档 - StrictMode.setThreadPolicy(new
StrictMode.ThreadPolicy.Builder() -
.detectDiskReads() -
.detectDiskWrites() -
.detectNetwork() // or .detectAll() for all detectable problems -
.penaltyLog() -
.build()); - StrictMode.setVmPolicy(new
StrictMode.VmPolicy.Builder() -
.detectLeakedSqlLiteObjec ts() -
.detectLeakedClosableObje cts() -
.penaltyLog() -
.penaltyDeath() -
.build());