当前位置: 代码迷 >> Android >> 一面android求解释是什么意思
  详细解决方案

一面android求解释是什么意思

热度:23   发布时间:2016-04-28 05:47:55.0
一端android求解释是什么意思
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()  
        .detectDiskReads()  
        .detectDiskWrites()  
        .detectNetwork()   // or .detectAll() for all detectable problems  
        .penaltyLog()  
        .build());  
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()  
        .detectLeakedSqlLiteObjects()  
        .detectLeakedClosableObjects()  
        .penaltyLog()  
        .penaltyDeath()  
        .build());

这段代码是干什么用的?
------解决方案--------------------
额,在android4.0之后,http请求不可以放在ui线程中了,有两种解决方法

1.http请求放到子线程中。(推荐)

2.就是lz的代码了,作用就是允许ui线程中进行http请求
  相关解决方案