下面的程式碼片段是為執行緒策略設定 StrictMode。本規範將在我們申請的入口點設定

StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()  
    .detectDiskWrites()  
    .penaltyLog() //Logs a message to LogCat  
    .build())