Android examples for Android OS:Thread
set Strict Mode for Thread Policy
//package com.java2s; import android.annotation.TargetApi; import android.os.Build; import android.os.StrictMode; public class Main { @TargetApi(Build.VERSION_CODES.GINGERBREAD) public static void setStrictMode() { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectAll().penaltyLog().build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() .detectAll().penaltyLog().build()); }/* w w w.ja va 2 s .c o m*/ }