Created
March 27, 2014 07:53
-
-
Save xalexchen/9802470 to your computer and use it in GitHub Desktop.
enableStrictMode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void enableStrictMode() { | |
if (PlatformUtils.hasGingerbread()) { | |
StrictMode.ThreadPolicy.Builder threadPolicyBuilder = | |
new StrictMode.ThreadPolicy.Builder() | |
.detectAll() | |
.penaltyLog(); | |
StrictMode.VmPolicy.Builder vmPolicyBuilder = | |
new StrictMode.VmPolicy.Builder() | |
.detectAll() | |
.penaltyLog(); | |
if (PlatformUtils.hasHoneycomb()) { | |
threadPolicyBuilder.penaltyFlashScreen(); | |
} | |
StrictMode.setThreadPolicy(threadPolicyBuilder.build()); | |
StrictMode.setVmPolicy(vmPolicyBuilder.build()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment