@SuppressLint("NewApi")
protected void onCreate(Bundle
savedInstanceState) {
StrictMode.setThreadPolicy(new
StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork() // or .detectAll() for all detectable
problems
.penaltyLog()
.build());
StrictMode.setVmPolicy(new
StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.penaltyLog()
.penaltyDeath()
.build());
代码中加入这么一段注释, 可以在主线程访问网络, 难道以后没一个activity里面都加入? 不是很麻烦,每次都需要执行这段代码不是效率不好?